Ticket #1654: recursive_variant.hpp.patch

File recursive_variant.hpp.patch, 1.1 KB (added by Steven Watanabe, 15 years ago)
  • recursive_variant.hpp

     
    2222#include "boost/mpl/aux_/lambda_arity_param.hpp"
    2323
    2424#if !defined(BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT)
     25#   include "boost/mpl/equal.hpp"
    2526#   include "boost/mpl/eval_if.hpp"
    2627#   include "boost/mpl/identity.hpp"
     28#   include "boost/mpl/if.hpp"
    2729#   include "boost/mpl/protect.hpp"
    2830#   include "boost/mpl/transform.hpp"
     31#   include "boost/type_traits/is_same.hpp"
    2932#else
    3033#   include "boost/preprocessor/cat.hpp"
    3134#   include "boost/preprocessor/repeat.hpp"
     
    98101
    99102public: // metafunction result
    100103
    101     typedef ::boost::variant< types > type;
     104    typedef typename mpl::if_<
     105          mpl::equal<initial_types, types, ::boost::is_same<mpl::_1, mpl::_2> >
     106        , ::boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >
     107        , ::boost::variant< over_sequence<types> >
     108        >::type type;
    102109
    103110#else // defined(BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT)
    104111