Skip to content

Instantly share code, notes, and snippets.

@bkuhns
Last active December 12, 2015 03:08
Show Gist options
  • Save bkuhns/4704831 to your computer and use it in GitHub Desktop.
Save bkuhns/4704831 to your computer and use it in GitHub Desktop.
class my_class
{
public:
struct args {
nullable<int> some_int;
nullable<float> some_float;
};
template<typename args_func>
my_class(args_func get_args)
{
args a;
get_args(a);
if (a.some_int.is_valid()) {
// We should probably do something to default some_int to a real value.
}
if (a.some_float.is_valid()) {
// ... same for some_float.
}
}
}
// [...]
my_class foo([](auto& a) {
a.some_int = 5;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment