1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/boost/variant/variant_fwd.hpp Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,253 @@
1.4 +//-----------------------------------------------------------------------------
1.5 +// boost variant/variant_fwd.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, Itay Maman
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_VARIANT_FWD_HPP
1.17 +#define BOOST_VARIANT_VARIANT_FWD_HPP
1.18 +
1.19 +#include "boost/variant/detail/config.hpp"
1.20 +
1.21 +#include "boost/blank_fwd.hpp"
1.22 +#include "boost/mpl/arg.hpp"
1.23 +#include "boost/mpl/limits/arity.hpp"
1.24 +#include "boost/mpl/aux_/na.hpp"
1.25 +#include "boost/preprocessor/cat.hpp"
1.26 +#include "boost/preprocessor/enum.hpp"
1.27 +#include "boost/preprocessor/enum_params.hpp"
1.28 +#include "boost/preprocessor/enum_shifted_params.hpp"
1.29 +#include "boost/preprocessor/repeat.hpp"
1.30 +
1.31 +///////////////////////////////////////////////////////////////////////////////
1.32 +// macro BOOST_VARIANT_LIMIT_TYPES
1.33 +//
1.34 +// Implementation-defined preprocessor symbol describing the actual
1.35 +// length of variant's pseudo-variadic template parameter list.
1.36 +//
1.37 +#include "boost/mpl/limits/list.hpp"
1.38 +#define BOOST_VARIANT_LIMIT_TYPES \
1.39 + BOOST_MPL_LIMIT_LIST_SIZE
1.40 +
1.41 +///////////////////////////////////////////////////////////////////////////////
1.42 +// macro BOOST_VARIANT_NO_REFERENCE_SUPPORT
1.43 +//
1.44 +// Defined if variant does not support references as bounded types.
1.45 +//
1.46 +#if defined(BOOST_VARIANT_AUX_BROKEN_CONSTRUCTOR_TEMPLATE_ORDERING) \
1.47 + && !defined(BOOST_VARIANT_AUX_HAS_CONSTRUCTOR_TEMPLATE_ORDERING_SFINAE_WKND) \
1.48 + && !defined(BOOST_VARIANT_NO_REFERENCE_SUPPORT)
1.49 +# define BOOST_VARIANT_NO_REFERENCE_SUPPORT
1.50 +#endif
1.51 +
1.52 +///////////////////////////////////////////////////////////////////////////////
1.53 +// macro BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT
1.54 +//
1.55 +// Defined if variant does not support make_variant_over (see below).
1.56 +//
1.57 +#if defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE)
1.58 +# define BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT
1.59 +#endif
1.60 +
1.61 +///////////////////////////////////////////////////////////////////////////////
1.62 +// macro BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT
1.63 +//
1.64 +// Defined if make_recursive_variant cannot be supported as documented.
1.65 +//
1.66 +// Note: Currently, MPL lambda facility is used as workaround if defined, and
1.67 +// so only types declared w/ MPL lambda workarounds will work.
1.68 +//
1.69 +
1.70 +#include "boost/variant/detail/substitute_fwd.hpp"
1.71 +
1.72 +#if defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE) \
1.73 + && !defined(BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT)
1.74 +# define BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT
1.75 +#endif
1.76 +
1.77 +///////////////////////////////////////////////////////////////////////////////
1.78 +// macro BOOST_VARIANT_RECURSIVE_VARIANT_MAX_ARITY
1.79 +//
1.80 +// Exposes maximum allowed arity of class templates with recursive_variant
1.81 +// arguments. That is,
1.82 +// make_recursive_variant< ..., T<[1], recursive_variant_, ... [N]> >.
1.83 +//
1.84 +#include "boost/mpl/limits/arity.hpp"
1.85 +#define BOOST_VARIANT_RECURSIVE_VARIANT_MAX_ARITY \
1.86 + BOOST_MPL_LIMIT_METAFUNCTION_ARITY
1.87 +
1.88 +///////////////////////////////////////////////////////////////////////////////
1.89 +// macro BOOST_VARIANT_ENUM_PARAMS
1.90 +//
1.91 +// Convenience macro for enumeration of BOOST_VARIANT_LIMIT_TYPES params.
1.92 +//
1.93 +// Rationale: Cleaner, simpler code for clients of variant library.
1.94 +//
1.95 +#define BOOST_VARIANT_ENUM_PARAMS( param ) \
1.96 + BOOST_PP_ENUM_PARAMS(BOOST_VARIANT_LIMIT_TYPES, param)
1.97 +
1.98 +///////////////////////////////////////////////////////////////////////////////
1.99 +// macro BOOST_VARIANT_ENUM_SHIFTED_PARAMS
1.100 +//
1.101 +// Convenience macro for enumeration of BOOST_VARIANT_LIMIT_TYPES-1 params.
1.102 +//
1.103 +#define BOOST_VARIANT_ENUM_SHIFTED_PARAMS( param ) \
1.104 + BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_VARIANT_LIMIT_TYPES, param)
1.105 +
1.106 +
1.107 +namespace boost {
1.108 +
1.109 +namespace detail { namespace variant {
1.110 +
1.111 +///////////////////////////////////////////////////////////////////////////////
1.112 +// (detail) class void_ and class template convert_void
1.113 +//
1.114 +// Provides the mechanism by which void(NN) types are converted to
1.115 +// mpl::void_ (and thus can be passed to mpl::list).
1.116 +//
1.117 +// Rationale: This is particularly needed for the using-declarations
1.118 +// workaround (below), but also to avoid associating mpl namespace with
1.119 +// variant in argument dependent lookups (which used to happen because of
1.120 +// defaulting of template parameters to mpl::void_).
1.121 +//
1.122 +
1.123 +struct void_;
1.124 +
1.125 +template <typename T>
1.126 +struct convert_void
1.127 +{
1.128 + typedef T type;
1.129 +};
1.130 +
1.131 +template <>
1.132 +struct convert_void< void_ >
1.133 +{
1.134 + typedef mpl::na type;
1.135 +};
1.136 +
1.137 +///////////////////////////////////////////////////////////////////////////////
1.138 +// (workaround) BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
1.139 +//
1.140 +// Needed to work around compilers that don't support using-declaration
1.141 +// overloads. (See the variant::initializer workarounds below.)
1.142 +//
1.143 +
1.144 +#if defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE)
1.145 +
1.146 +// (detail) tags voidNN -- NN defined on [0, BOOST_VARIANT_LIMIT_TYPES)
1.147 +//
1.148 +// Defines void types that are each unique and specializations of
1.149 +// convert_void that yields mpl::na for each voidNN type.
1.150 +//
1.151 +
1.152 +#define BOOST_VARIANT_DETAIL_DEFINE_VOID_N(z,N,_) \
1.153 + struct BOOST_PP_CAT(void,N); \
1.154 + \
1.155 + template <> \
1.156 + struct convert_void< BOOST_PP_CAT(void,N) > \
1.157 + { \
1.158 + typedef mpl::na type; \
1.159 + }; \
1.160 + /**/
1.161 +
1.162 +BOOST_PP_REPEAT(
1.163 + BOOST_VARIANT_LIMIT_TYPES
1.164 + , BOOST_VARIANT_DETAIL_DEFINE_VOID_N
1.165 + , _
1.166 + )
1.167 +
1.168 +#undef BOOST_VARIANT_DETAIL_DEFINE_VOID_N
1.169 +
1.170 +#endif // BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE workaround
1.171 +
1.172 +}} // namespace detail::variant
1.173 +
1.174 +///////////////////////////////////////////////////////////////////////////////
1.175 +// (detail) macro BOOST_VARIANT_AUX_DECLARE_PARAM
1.176 +//
1.177 +// Template parameter list for variant and recursive_variant declarations.
1.178 +//
1.179 +
1.180 +#if !defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE)
1.181 +
1.182 +# define BOOST_VARIANT_AUX_DECLARE_PARAMS_IMPL(z, N, T) \
1.183 + typename BOOST_PP_CAT(T,N) = detail::variant::void_ \
1.184 + /**/
1.185 +
1.186 +#else // defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE)
1.187 +
1.188 +# define BOOST_VARIANT_AUX_DECLARE_PARAMS_IMPL(z, N, T) \
1.189 + typename BOOST_PP_CAT(T,N) = BOOST_PP_CAT(detail::variant::void,N) \
1.190 + /**/
1.191 +
1.192 +#endif // BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE workaround
1.193 +
1.194 +#define BOOST_VARIANT_AUX_DECLARE_PARAMS \
1.195 + BOOST_PP_ENUM( \
1.196 + BOOST_VARIANT_LIMIT_TYPES \
1.197 + , BOOST_VARIANT_AUX_DECLARE_PARAMS_IMPL \
1.198 + , T \
1.199 + ) \
1.200 + /**/
1.201 +
1.202 +///////////////////////////////////////////////////////////////////////////////
1.203 +// class template variant (concept inspired by Andrei Alexandrescu)
1.204 +//
1.205 +// Efficient, type-safe bounded discriminated union.
1.206 +//
1.207 +// Preconditions:
1.208 +// - Each type must be unique.
1.209 +// - No type may be const-qualified.
1.210 +//
1.211 +// Proper declaration form:
1.212 +// variant<types> (where types is a type-sequence)
1.213 +// or
1.214 +// variant<T0,T1,...,Tn> (where T0 is NOT a type-sequence)
1.215 +//
1.216 +template < BOOST_VARIANT_AUX_DECLARE_PARAMS > class variant;
1.217 +
1.218 +///////////////////////////////////////////////////////////////////////////////
1.219 +// metafunction make_recursive_variant
1.220 +//
1.221 +// Exposes a boost::variant with recursive_variant_ tags (below) substituted
1.222 +// with the variant itself (wrapped as needed with boost::recursive_wrapper).
1.223 +//
1.224 +template < BOOST_VARIANT_AUX_DECLARE_PARAMS > struct make_recursive_variant;
1.225 +
1.226 +#undef BOOST_VARIANT_AUX_DECLARE_PARAMS_IMPL
1.227 +#undef BOOST_VARIANT_AUX_DECLARE_PARAMS
1.228 +
1.229 +///////////////////////////////////////////////////////////////////////////////
1.230 +// type recursive_variant_
1.231 +//
1.232 +// Tag type indicates where recursive variant substitution should occur.
1.233 +//
1.234 +#if !defined(BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT)
1.235 + struct recursive_variant_;
1.236 +#else
1.237 + typedef mpl::arg<1> recursive_variant_;
1.238 +#endif
1.239 +
1.240 +///////////////////////////////////////////////////////////////////////////////
1.241 +// metafunction make_variant_over
1.242 +//
1.243 +// Result is a variant w/ types of the specified type sequence.
1.244 +//
1.245 +template <typename Types> struct make_variant_over;
1.246 +
1.247 +///////////////////////////////////////////////////////////////////////////////
1.248 +// metafunction make_recursive_variant_over
1.249 +//
1.250 +// Result is a recursive variant w/ types of the specified type sequence.
1.251 +//
1.252 +template <typename Types> struct make_recursive_variant_over;
1.253 +
1.254 +} // namespace boost
1.255 +
1.256 +#endif // BOOST_VARIANT_VARIANT_FWD_HPP