source: NonGTP/Boost/boost/variant/detail/enable_recursive_fwd.hpp @ 857

Revision 857, 3.0 KB checked in by igarcia, 18 years ago (diff)
Line 
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
26namespace boost {
27namespace 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
37template <typename T>
38struct recursive_flag
39{
40    typedef T type;
41};
42
43#else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
44
45struct recursive_flag_tag
46{
47};
48
49template <typename T>
50struct 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
66template <typename T>
67struct is_recursive_flag
68    : mpl::false_
69{
70};
71
72template <typename T>
73struct is_recursive_flag< recursive_flag<T> >
74    : mpl::true_
75{
76};
77
78#else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
79
80template <typename T>
81struct 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//
95template <
96      typename T
97    , typename RecursiveVariant
98    , typename NoWrapper = mpl::false_
99    >
100struct enable_recursive;
101
102///////////////////////////////////////////////////////////////////////////////
103// (detail) metafunction class quoted_enable_recursive
104//
105// Same behavior as enable_recursive metafunction (see above).
106//
107template <
108      typename RecursiveVariant
109    , typename NoWrapper = mpl::false_
110    >
111struct quoted_enable_recursive;
112
113}} // namespace detail::variant
114} // namespace boost
115
116#endif // BOOST_VARIANT_DETAIL_ENABLE_RECURSIVE_FWD_HPP
Note: See TracBrowser for help on using the repository browser.