epoc32/include/stdapis/boost/variant/recursive_variant.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/variant/recursive_variant.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,182 @@
     1.4 +//-----------------------------------------------------------------------------
     1.5 +// boost variant/recursive_variant.hpp header file
     1.6 +// See http://www.boost.org for updates, documentation, and revision history.
     1.7 +//-----------------------------------------------------------------------------
     1.8 +//
     1.9 +// Copyright (c) 2003
    1.10 +// Eric Friedman
    1.11 +//
    1.12 +// Distributed under the Boost Software License, Version 1.0. (See
    1.13 +// accompanying file LICENSE_1_0.txt or copy at
    1.14 +// http://www.boost.org/LICENSE_1_0.txt)
    1.15 +
    1.16 +#ifndef BOOST_VARIANT_RECURSIVE_VARIANT_HPP
    1.17 +#define BOOST_VARIANT_RECURSIVE_VARIANT_HPP
    1.18 +
    1.19 +#include "boost/variant/variant_fwd.hpp"
    1.20 +#include "boost/variant/detail/enable_recursive.hpp"
    1.21 +#include "boost/variant/detail/substitute_fwd.hpp"
    1.22 +#include "boost/variant/detail/make_variant_list.hpp"
    1.23 +#include "boost/variant/detail/over_sequence.hpp"
    1.24 +
    1.25 +#include "boost/mpl/aux_/lambda_arity_param.hpp"
    1.26 +
    1.27 +#if !defined(BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT)
    1.28 +#   include "boost/mpl/eval_if.hpp"
    1.29 +#   include "boost/mpl/identity.hpp"
    1.30 +#   include "boost/mpl/protect.hpp"
    1.31 +#   include "boost/mpl/transform.hpp"
    1.32 +#else
    1.33 +#   include "boost/preprocessor/cat.hpp"
    1.34 +#   include "boost/preprocessor/repeat.hpp"
    1.35 +#endif
    1.36 +
    1.37 +#include "boost/mpl/bool.hpp"
    1.38 +#include "boost/mpl/is_sequence.hpp"
    1.39 +#include "boost/variant/variant.hpp"
    1.40 +
    1.41 +namespace boost {
    1.42 +
    1.43 +namespace detail { namespace variant {
    1.44 +
    1.45 +///////////////////////////////////////////////////////////////////////////////
    1.46 +// (detail) metafunction specialization substitute
    1.47 +//
    1.48 +// Handles embedded variant types when substituting for recursive_variant_.
    1.49 +//
    1.50 +
    1.51 +#if !defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE)
    1.52 +
    1.53 +template <
    1.54 +      BOOST_VARIANT_ENUM_PARAMS(typename T)
    1.55 +    , typename RecursiveVariant
    1.56 +      BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(typename Arity)
    1.57 +    >
    1.58 +struct substitute<
    1.59 +      ::boost::variant<
    1.60 +          recursive_flag< T0 >
    1.61 +        , BOOST_VARIANT_ENUM_SHIFTED_PARAMS(T)
    1.62 +        >
    1.63 +    , RecursiveVariant
    1.64 +    , ::boost::recursive_variant_
    1.65 +      BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(Arity)
    1.66 +    >
    1.67 +{
    1.68 +    typedef ::boost::variant<
    1.69 +          recursive_flag< T0 >
    1.70 +        , BOOST_VARIANT_ENUM_SHIFTED_PARAMS(T)
    1.71 +        > type;
    1.72 +};
    1.73 +
    1.74 +template <
    1.75 +      BOOST_VARIANT_ENUM_PARAMS(typename T)
    1.76 +    , typename RecursiveVariant
    1.77 +      BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(typename Arity)
    1.78 +    >
    1.79 +struct substitute<
    1.80 +      ::boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >
    1.81 +    , RecursiveVariant
    1.82 +    , ::boost::recursive_variant_
    1.83 +      BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(Arity)
    1.84 +    >
    1.85 +{
    1.86 +
    1.87 +#if !defined(BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT)
    1.88 +
    1.89 +private: // helpers, for metafunction result (below)
    1.90 +
    1.91 +    typedef typename mpl::eval_if<
    1.92 +          ::boost::detail::variant::is_over_sequence<T0>
    1.93 +        , mpl::identity< T0 >
    1.94 +        , make_variant_list< BOOST_VARIANT_ENUM_PARAMS(T) >
    1.95 +        >::type initial_types;
    1.96 +
    1.97 +    typedef typename mpl::transform<
    1.98 +          initial_types
    1.99 +        , mpl::protect< quoted_enable_recursive<RecursiveVariant,mpl::true_> >
   1.100 +        >::type types;
   1.101 +
   1.102 +public: // metafunction result
   1.103 +
   1.104 +    typedef ::boost::variant< types > type;
   1.105 +
   1.106 +#else // defined(BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT)
   1.107 +
   1.108 +private: // helpers, for metafunction result (below)
   1.109 +
   1.110 +    #define BOOST_VARIANT_AUX_ENABLE_RECURSIVE_TYPEDEFS(z,N,_)  \
   1.111 +        typedef typename enable_recursive<   \
   1.112 +              BOOST_PP_CAT(T,N)              \
   1.113 +            , RecursiveVariant               \
   1.114 +            , mpl::true_                     \
   1.115 +            >::type BOOST_PP_CAT(wknd_T,N);  \
   1.116 +        /**/
   1.117 +
   1.118 +    BOOST_PP_REPEAT(
   1.119 +          BOOST_VARIANT_LIMIT_TYPES
   1.120 +        , BOOST_VARIANT_AUX_ENABLE_RECURSIVE_TYPEDEFS
   1.121 +        , _
   1.122 +        )
   1.123 +
   1.124 +    #undef BOOST_VARIANT_AUX_ENABLE_RECURSIVE_TYPEDEFS
   1.125 +
   1.126 +public: // metafunction result
   1.127 +
   1.128 +    typedef ::boost::variant< BOOST_VARIANT_ENUM_PARAMS(wknd_T) > type;
   1.129 +
   1.130 +#endif // BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT workaround
   1.131 +
   1.132 +};
   1.133 +
   1.134 +#else // defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE)
   1.135 +
   1.136 +//
   1.137 +// no specializations: embedded variants unsupported on these compilers!
   1.138 +//
   1.139 +
   1.140 +#endif // !defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE)
   1.141 +
   1.142 +}} // namespace detail::variant
   1.143 +
   1.144 +///////////////////////////////////////////////////////////////////////////////
   1.145 +// metafunction make_recursive_variant
   1.146 +//
   1.147 +// See docs and boost/variant/variant_fwd.hpp for more information.
   1.148 +//
   1.149 +template < BOOST_VARIANT_ENUM_PARAMS(typename T) >
   1.150 +struct make_recursive_variant
   1.151 +{
   1.152 +public: // metafunction result
   1.153 +
   1.154 +    typedef boost::variant<
   1.155 +          detail::variant::recursive_flag< T0 >
   1.156 +        , BOOST_VARIANT_ENUM_SHIFTED_PARAMS(T)
   1.157 +        > type;
   1.158 +
   1.159 +};
   1.160 +
   1.161 +///////////////////////////////////////////////////////////////////////////////
   1.162 +// metafunction make_recursive_variant_over
   1.163 +//
   1.164 +// See docs and boost/variant/variant_fwd.hpp for more information.
   1.165 +//
   1.166 +template <typename Types>
   1.167 +struct make_recursive_variant_over
   1.168 +{
   1.169 +private: // precondition assertions
   1.170 +
   1.171 +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
   1.172 +    BOOST_STATIC_ASSERT(( ::boost::mpl::is_sequence<Types>::value ));
   1.173 +#endif
   1.174 +
   1.175 +public: // metafunction result
   1.176 +
   1.177 +    typedef typename make_recursive_variant<
   1.178 +          detail::variant::over_sequence< Types >
   1.179 +        >::type type;
   1.180 +
   1.181 +};
   1.182 +
   1.183 +} // namespace boost
   1.184 +
   1.185 +#endif // BOOST_VARIANT_RECURSIVE_VARIANT_HPP