Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11132: Boost.Variant's boost::recursive_wrapper missing noexcept specifier on move constructor
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-06-22 19:59:39
#11132: Boost.Variant's boost::recursive_wrapper missing noexcept specifier on move
constructor
-------------------------------+-----------------------
Reporter: peterhuene@⦠| Owner: apolukhin
Type: Bugs | Status: assigned
Milestone: To Be Determined | Component: variant
Version: Boost 1.57.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+-----------------------
Changes (by apolukhin):
* owner: ebf => apolukhin
* status: new => assigned
Comment:
This issue has been discussed a lot. After a very long discussion it was
decided to leave `recursive_wrapper` as is.
Personaly I dislike the existing approach, but agree that it must stay as
is.
The only way that I could help you, is to show some possible workarounds.
Here's a workaround for std::vectors that support incomplete/forward
declared types (fastest possible solution):
{{{
#include <boost/variant.hpp>
#include <vector>
using namespace std;
using namespace boost;
struct foo
{
foo() = default;
foo(foo&&) noexcept = default;
foo(foo const&) = delete;
};
struct variant_type: boost::variant<foo, vector<variant_type> > {
typedef boost::variant<foo, vector<variant_type> > base_t;
variant_type() = default;
template <class T>
variant_type(T&& v)
: base_t(std::forward<T>(v))
{}
};
int main() {
vector<variant_type> value;
value.emplace_back();
variant_type other = std::move(value);
}
}}}
This example must work on popular STL implementations.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11132#comment:5> 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:18 UTC