Re: [Boost-bugs] [Boost C++ Libraries] #7718: Basic rvalue and C++11 support (part 2)

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7718: Basic rvalue and C++11 support (part 2)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-01-21 00:31:03


#7718: Basic rvalue and C++11 support (part 2)
---------------------------+------------------------------------------------
  Reporter: apolukhin | Owner: ebf
      Type: Patches | Status: reopened
 Milestone: Boost 1.53.0 | Component: variant
   Version: Boost 1.52.0 | Severity: Optimization
Resolution: | Keywords:
---------------------------+------------------------------------------------

Comment (by djowel):

 :-) There you go (smiley). I'm sorry if I overreacted. This issue is very
 important for me as I've invested heavily on variant and I expect an
 optimal solution to this problem.

 I know the code of variant and recursive_variant. This patch is about
 variant. recursive_wrapper happens to be an integral part of variant. No,
 the current code does not implement Peter Dimov's suggestion about move
 yet. If you think it does, then please point me to the location where this
 is implemented.

 The idea is simplified with Peter's note:

 <quote>
   No, I'm suggesting that move (in the presence of recursive_wrappers) can
 be
   enabled only when there is at least one type that is nothrow-default-
 constructible,
   regardless of whether it's current.

   typedef variant<int, recursive_wrapper<foo>> V;

   V v1( std::move(v2) );

   This move-constructs v1 from v2 and leaves int() into v2.
 </quote>

 So, this is a special case handling for recursive_variant. Depending on
 the implementation, there might be a friend relationship with variant in
 recursive_wrapper, allowing it to grab its contents and place it in the
 destination.

 Note: I'll just check the the first type. Variant's design somehow makes
 the first type important. It's the one that's default constructed and it's
 (almost always) a nothrow-default-constructible type.

 Tell me if you need help in implementing this. I know my way around
 variant.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7718#comment:13>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:11 UTC