1 | //----------------------------------------------------------------------------- |
---|
2 | // boost variant/detail/enable_recursive_fwd.hpp header file |
---|
3 | // See http://www.boost.org for updates, documentation, and revision history. |
---|
4 | //----------------------------------------------------------------------------- |
---|
5 | // |
---|
6 | // Copyright (c) 2003 |
---|
7 | // Eric Friedman |
---|
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_ENABLE_RECURSIVE_FWD_HPP |
---|
14 | #define BOOST_VARIANT_DETAIL_ENABLE_RECURSIVE_FWD_HPP |
---|
15 | |
---|
16 | #include "boost/mpl/aux_/config/ctps.hpp" |
---|
17 | |
---|
18 | #include "boost/mpl/bool_fwd.hpp" |
---|
19 | |
---|
20 | #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) |
---|
21 | # include "boost/mpl/bool.hpp" |
---|
22 | #else |
---|
23 | # include "boost/type_traits/is_base_and_derived.hpp" |
---|
24 | #endif |
---|
25 | |
---|
26 | namespace boost { |
---|
27 | namespace detail { namespace variant { |
---|
28 | |
---|
29 | /////////////////////////////////////////////////////////////////////////////// |
---|
30 | // (detail) tag recursive_flag |
---|
31 | // |
---|
32 | // Signifies that the variant should perform recursive substituion. |
---|
33 | // |
---|
34 | |
---|
35 | #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) |
---|
36 | |
---|
37 | template <typename T> |
---|
38 | struct recursive_flag |
---|
39 | { |
---|
40 | typedef T type; |
---|
41 | }; |
---|
42 | |
---|
43 | #else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) |
---|
44 | |
---|
45 | struct recursive_flag_tag |
---|
46 | { |
---|
47 | }; |
---|
48 | |
---|
49 | template <typename T> |
---|
50 | struct recursive_flag |
---|
51 | : recursive_flag_tag |
---|
52 | { |
---|
53 | typedef T type; |
---|
54 | }; |
---|
55 | |
---|
56 | #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION workaround |
---|
57 | |
---|
58 | /////////////////////////////////////////////////////////////////////////////// |
---|
59 | // (detail) metafunction is_recursive_flag |
---|
60 | // |
---|
61 | // Signifies that the variant should perform recursive substituion. |
---|
62 | // |
---|
63 | |
---|
64 | #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) |
---|
65 | |
---|
66 | template <typename T> |
---|
67 | struct is_recursive_flag |
---|
68 | : mpl::false_ |
---|
69 | { |
---|
70 | }; |
---|
71 | |
---|
72 | template <typename T> |
---|
73 | struct is_recursive_flag< recursive_flag<T> > |
---|
74 | : mpl::true_ |
---|
75 | { |
---|
76 | }; |
---|
77 | |
---|
78 | #else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) |
---|
79 | |
---|
80 | template <typename T> |
---|
81 | struct is_recursive_flag |
---|
82 | : is_base_and_derived< recursive_flag_tag,T > |
---|
83 | { |
---|
84 | }; |
---|
85 | |
---|
86 | #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION workaround |
---|
87 | |
---|
88 | /////////////////////////////////////////////////////////////////////////////// |
---|
89 | // (detail) metafunction enable_recursive |
---|
90 | // |
---|
91 | // Attempts recursive_variant_ tag substitution, wrapping with |
---|
92 | // boost::recursive_wrapper if substituion occurs w/ non-indirect result |
---|
93 | // (i.e., not a reference or pointer) *and* NoWrapper is false_. |
---|
94 | // |
---|
95 | template < |
---|
96 | typename T |
---|
97 | , typename RecursiveVariant |
---|
98 | , typename NoWrapper = mpl::false_ |
---|
99 | > |
---|
100 | struct enable_recursive; |
---|
101 | |
---|
102 | /////////////////////////////////////////////////////////////////////////////// |
---|
103 | // (detail) metafunction class quoted_enable_recursive |
---|
104 | // |
---|
105 | // Same behavior as enable_recursive metafunction (see above). |
---|
106 | // |
---|
107 | template < |
---|
108 | typename RecursiveVariant |
---|
109 | , typename NoWrapper = mpl::false_ |
---|
110 | > |
---|
111 | struct quoted_enable_recursive; |
---|
112 | |
---|
113 | }} // namespace detail::variant |
---|
114 | } // namespace boost |
---|
115 | |
---|
116 | #endif // BOOST_VARIANT_DETAIL_ENABLE_RECURSIVE_FWD_HPP |
---|