fix doc example typo
[boost.git] / boost / variant / detail / enable_recursive_fwd.hpp
blob3336c1f76a471401800023c001a22f03645d6105
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)
13 #ifndef BOOST_VARIANT_DETAIL_ENABLE_RECURSIVE_FWD_HPP
14 #define BOOST_VARIANT_DETAIL_ENABLE_RECURSIVE_FWD_HPP
16 #include "boost/mpl/aux_/config/ctps.hpp"
18 #include "boost/mpl/bool_fwd.hpp"
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
26 namespace boost {
27 namespace detail { namespace variant {
29 ///////////////////////////////////////////////////////////////////////////////
30 // (detail) tag recursive_flag
32 // Signifies that the variant should perform recursive substituion.
35 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
37 template <typename T>
38 struct recursive_flag
40 typedef T type;
43 #else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
45 struct recursive_flag_tag
49 template <typename T>
50 struct recursive_flag
51 : recursive_flag_tag
53 typedef T type;
56 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION workaround
58 ///////////////////////////////////////////////////////////////////////////////
59 // (detail) metafunction is_recursive_flag
61 // Signifies that the variant should perform recursive substituion.
64 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
66 template <typename T>
67 struct is_recursive_flag
68 : mpl::false_
72 template <typename T>
73 struct is_recursive_flag< recursive_flag<T> >
74 : mpl::true_
78 #else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
80 template <typename T>
81 struct is_recursive_flag
82 : is_base_and_derived< recursive_flag_tag,T >
86 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION workaround
88 ///////////////////////////////////////////////////////////////////////////////
89 // (detail) metafunction enable_recursive
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_.
95 template <
96 typename T
97 , typename RecursiveVariant
98 , typename NoWrapper = mpl::false_
100 struct enable_recursive;
102 ///////////////////////////////////////////////////////////////////////////////
103 // (detail) metafunction class quoted_enable_recursive
105 // Same behavior as enable_recursive metafunction (see above).
107 template <
108 typename RecursiveVariant
109 , typename NoWrapper = mpl::false_
111 struct quoted_enable_recursive;
113 }} // namespace detail::variant
114 } // namespace boost
116 #endif // BOOST_VARIANT_DETAIL_ENABLE_RECURSIVE_FWD_HPP