1 //-----------------------------------------------------------------------------
2 // boost variant/detail/make_variant_list.hpp header file
3 // See http://www.boost.org for updates, documentation, and revision history.
4 //-----------------------------------------------------------------------------
6 // Copyright (c) 2002-2003 Eric Friedman, Itay Maman
7 // Copyright (c) 2013 Antony Polukhin
9 // Distributed under the Boost Software License, Version 1.0. (See
10 // accompanying file LICENSE_1_0.txt or copy at
11 // http://www.boost.org/LICENSE_1_0.txt)
13 #ifndef BOOST_VARIANT_DETAIL_MAKE_VARIANT_LIST_HPP
14 #define BOOST_VARIANT_DETAIL_MAKE_VARIANT_LIST_HPP
16 #include <boost/variant/variant_fwd.hpp>
18 #include <boost/mpl/list.hpp>
19 #include <boost/preprocessor/cat.hpp>
20 #include <boost/preprocessor/enum.hpp>
23 namespace detail { namespace variant {
25 ///////////////////////////////////////////////////////////////////////////////
26 // (detail) metafunction make_variant_list
28 // Provides a MPL-compatible sequence with the specified non-void types
31 // Rationale: see class template convert_void (variant_fwd.hpp) and using-
32 // declaration workaround (below).
35 #if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES)
37 template < typename... T >
38 struct make_variant_list
40 typedef typename mpl::list< T... >::type type;
43 #else // defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES)
45 template < BOOST_VARIANT_ENUM_PARAMS(typename T) >
46 struct make_variant_list
48 public: // metafunction result
50 // [Define a macro to convert any void(NN) tags to mpl::void...]
51 # define BOOST_VARIANT_AUX_CONVERT_VOID(z, N,_) \
52 typename convert_void< BOOST_PP_CAT(T,N) >::type
54 // [...so that the specified types can be passed to mpl::list...]
55 typedef typename mpl::list<
57 BOOST_VARIANT_LIMIT_TYPES
58 , BOOST_VARIANT_AUX_CONVERT_VOID
63 // [...and, finally, the conversion macro can be undefined:]
64 # undef BOOST_VARIANT_AUX_CONVERT_VOID
68 #endif // BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES workaround
70 }} // namespace detail::variant
73 #endif // BOOST_VARIANT_DETAIL_MAKE_VARIANT_LIST_HPP