On Sat, Nov 12, 2011 at 1:08 PM, Gennadiy Rozental
<rogeeff@gmail.com> wrote:
Ovanes Markarian <om_boost <at>
keywallet.com> writes:
> You need to make a list of references to Bs:
> B b1, b2;
> auto z1 = fusion::make_list( ref(b1), ref(b2) );
> auto z2 = fusion::as_list( fusion::transform( z1, make_c() ) );
This one indeed works, but what I am really after is something like this:
auto z1 = fusion::make_list( B(), B() );
auto z2 = fusion::as_list( fusion::transform( z1, make_c() ) );
I know first line will move constructed instances into list z1. Next I need to
mutate them and adding boost::ref around B() is impossible. In reality my use
case somewhat more complicated. Something like this:
Quickly, I can come up with: Declare the mutating member inside B (B::make_c()) as const and declare mutated members with mutable. This will work as well. Than you don't need to pass B by ref. You can than make it as you stated.
May be there is a more elegant solution, I will think about it.
Best Regards,
Ovanes