[Boost-bugs] [Boost C++ Libraries] #8554: make_variant_over requires Extensible Sequence

Subject: [Boost-bugs] [Boost C++ Libraries] #8554: make_variant_over requires Extensible Sequence
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-05-08 01:13:33

#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
 Keywords: |
 Variant tries to perform operations not supported by a Forward Sequence on
 the sequence provided to make_variant_over.

 Conversely the type of variant<T>::types appears to be an Extensible
 Sequence which means:

 Can fix by amending docs to specify that sequences used must be Extensible
 Sequences (needs both changes as motivation for composing via joint_view
 was to avoid applying operations requiring Extensible Sequence to


 Can fix by composing an Extensible Sequence in make_variant_over -
 something like:

 typedef boost::mpl::vector<> empty;
 typedef boost::mpl::insert_range<empty, boost::mpl::end<empty>::type,
 Sequence>::type ExtensibleSequence;

 The following example shows the issue

 #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

 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>
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