
10 Feb
2009
10 Feb
'09
2:45 a.m.
v = boost::reference_wrapper<foo>(f);
You can also write that as
v = boost::ref(f);
Thanks, I hadn't actually seen the reference_wrapper library before, so didn't look too deeply (just far enough to know that passing the raw object didn't work). So, effectively, I'm proposing a small addition to boost::variant, in some sense 'embedding' the boost::reference_wrapper functionality into it, and applying a little syntactic sugar. Does anybody see any value in this, or is it just me? (In the meantime, I can always use a small wrapper to boost::variant that adds these changes.) Chris