Boost logo

Boost :

Subject: Re: [boost] [move] new rvalue reference emulation
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2012-01-23 11:55:52


On Sat, Jan 21, 2012 at 4:22 PM, Vicente Botet <vicente.botet_at_[hidden]>wrote:

>
> Jeffrey Lee Hellrung, Jr.-2 wrote
> >
> > 2011/4/11 Ion Gaztañaga &lt;igaztanaga@&gt;
> >
> >> El 11/04/2011 3:22, Jeffrey Lee Hellrung, Jr. escribió:
> >>
> >>> On Mon, Apr 4, 2011 at 10:36 AM, Jeffrey Lee Hellrung, Jr.<
> >>> jeffrey.hellrung@> wrote:
> >>> [...snipping original description...]
> >>>
> >>
> >> Sorry for the lack of feedaback! I tried to your example in some
> >> compilers
> >> and checked that MSVC7.1 does not like pointer to function storage in
> the
> >> generic rv (it's a msvc bug, but annoying, nevertheless).
> >
> >
> > It sounds like that could be easily worked around without too much
> > obfuscation.
> >
> >
> >> I've been very busy with several interprocess issues and I couldn't take
> >> time to study this but I promise to dedicate some time soon.
> >
> >
> > Great, thanks; as long as I know that you've seen the message, I'm happy
> > :)
> >
> >
> >> I was a bit confused as you use a function object in your example. Can't
> >> we
> >> take rid of that function object and apply it to free functions?
> >
> >
> > You can, but you would still need a function object to execute the
> visitor
> > pattern on the genrv object, since the visitor must be polymorphic (it
> > must
> > accept many different argument types). Making the function object *both*
> > the visitor *and* the "housing" of the overload set is merely a
> > convenience.
> >
> >
> >> How can we apply this to the constructor of an object?
> >>
> >
> > Unfortunately, here the technique can get quite cumbersome. After
> > thinking
> > a little about this, I think you'd have to be in one of the following
> > situations:
> > - Use no initializer lists, and perform the construction in an "init"
> > method. This should be okay for, e.g., pimpl classes.
> > - All member object(s) and base class(es) that receive the
> to-be-forwarded
> > argument can accept a genrv object.
> > - Use some kind of "typeless opaque storage" for all member object(s)
> that
> > receive the to-be-forwarded argument to delay initialization until the
> > constructor body. Should be strongly discouraged, but sometimes you
> gotta
> > do what you gotta do...
> >
> >
>
> Hi,
>
> Are there any news about this Move improvements?
>
> Best,
> Vicente

None from my end.

I've thought about it a bit since, and I *think* you can get by using this
with any change to the existing Boost.Move infrastructure (only additions),
so, if desired, it could be added to an "advanced techniques in C++03"
section or something like that.

Do you think it's worth adding to Boost.Move?

- Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk