Subject: Re: [Boost-bugs] [Boost C++ Libraries] #8554: make_variant_over requires Extensible Sequence
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-05-08 01:19:48
#8554: make_variant_over requires Extensible Sequence
----------------------------------------------------+-----------------------
Reporter: Darryl Green <darryl.green@â¦> | Owner: ebf
Type: Bugs | Status: new
Milestone: To Be Determined | Component: variant
Version: Boost 1.53.0 | Severity: Problem
Resolution: | Keywords:
----------------------------------------------------+-----------------------
Comment (by Darryl Green <darryl.green@â¦>):
Sorry about formatting - try this....
{{{#!C++
// possible "fix" to apply in make_variant_over
typedef boost::mpl::vector<> empty; typedef
boost::mpl::insert_range<empty, boost::mpl::end<empty>::type,
Sequence>::type ExtensibleSequence;
// example
#include <string>
#include <boost/variant.hpp>
#include <boost/mpl/joint_view.hpp>
#include <boost/mpl/insert_range.hpp>
typedef boost::variant<int> v1;
typedef boost::variant<std::string> v2;
typedef boost::make_variant_over<boost::mpl::joint_view<v1::types,
v2::types>::type>::type v3; // FAILS - requires Extensible Sequence
//typedef boost::variant<int, std::string> v3; // OK (obviously)
//typedef boost::make_variant_over<boost::mpl::insert_range<v1::types,
//boost::mpl::end<v1::types>::type, v2::types::type>::type>::type v3; //
OK (so types is probably an Extensible Sequence as insert_range works on
it...)
int main(int argc, char *argv[])
{
v1 a = 1;
v2 b = "2";
v3 c = a;
return boost::get<int>(c);
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/8554#comment:1> 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:13 UTC