1 | //-----------------------------------------------------------------------------
|
---|
2 | // boost variant/detail/make_variant_list.hpp header file
|
---|
3 | // See http://www.boost.org for updates, documentation, and revision history.
|
---|
4 | //-----------------------------------------------------------------------------
|
---|
5 | //
|
---|
6 | // Copyright (c) 2002-2003
|
---|
7 | // Eric Friedman, Itay Maman
|
---|
8 | //
|
---|
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)
|
---|
12 |
|
---|
13 | #ifndef BOOST_VARIANT_DETAIL_MAKE_VARIANT_LIST_HPP
|
---|
14 | #define BOOST_VARIANT_DETAIL_MAKE_VARIANT_LIST_HPP
|
---|
15 |
|
---|
16 | #include "boost/variant/variant_fwd.hpp"
|
---|
17 |
|
---|
18 | #include "boost/mpl/list.hpp"
|
---|
19 | #include "boost/preprocessor/cat.hpp"
|
---|
20 | #include "boost/preprocessor/enum.hpp"
|
---|
21 |
|
---|
22 | namespace boost {
|
---|
23 | namespace detail { namespace variant {
|
---|
24 |
|
---|
25 | ///////////////////////////////////////////////////////////////////////////////
|
---|
26 | // (detail) metafunction make_variant_list
|
---|
27 | //
|
---|
28 | // Provides a MPL-compatible sequence with the specified non-void types
|
---|
29 | // as arguments.
|
---|
30 | //
|
---|
31 | // Rationale: see class template convert_void (variant_fwd.hpp) and using-
|
---|
32 | // declaration workaround (below).
|
---|
33 | //
|
---|
34 | template < BOOST_VARIANT_ENUM_PARAMS(typename T) >
|
---|
35 | struct make_variant_list
|
---|
36 | {
|
---|
37 | public: // metafunction result
|
---|
38 |
|
---|
39 | // [Define a macro to convert any void(NN) tags to mpl::void...]
|
---|
40 | # define BOOST_VARIANT_AUX_CONVERT_VOID(z, N,_) \
|
---|
41 | typename convert_void< BOOST_PP_CAT(T,N) >::type
|
---|
42 |
|
---|
43 | // [...so that the specified types can be passed to mpl::list...]
|
---|
44 | typedef typename mpl::list<
|
---|
45 | BOOST_PP_ENUM(
|
---|
46 | BOOST_VARIANT_LIMIT_TYPES
|
---|
47 | , BOOST_VARIANT_AUX_CONVERT_VOID
|
---|
48 | , _
|
---|
49 | )
|
---|
50 | >::type type;
|
---|
51 |
|
---|
52 | // [...and, finally, the conversion macro can be undefined:]
|
---|
53 | # undef BOOST_VARIANT_AUX_CONVERT_VOID
|
---|
54 |
|
---|
55 | };
|
---|
56 |
|
---|
57 | }} // namespace detail::variant
|
---|
58 | } // namespace boost
|
---|
59 |
|
---|
60 | #endif // BOOST_VARIANT_DETAIL_MAKE_VARIANT_LIST_HPP
|
---|