| 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 | # include <boost/mpl/bool.hpp> |
| 21 | |
| 22 | namespace boost { |
| 23 | namespace detail { namespace variant { |
| 24 | |
| 25 | /////////////////////////////////////////////////////////////////////////////// |
| 26 | // (detail) tag recursive_flag |
| 27 | // |
| 28 | // Signifies that the variant should perform recursive substituion. |
| 29 | // |
| 30 | |
| 31 | |
| 32 | template <typename T> |
| 33 | struct recursive_flag |
| 34 | { |
| 35 | typedef T type; |
| 36 | }; |
| 37 | |
| 38 | |
| 39 | /////////////////////////////////////////////////////////////////////////////// |
| 40 | // (detail) metafunction is_recursive_flag |
| 41 | // |
| 42 | // Signifies that the variant should perform recursive substituion. |
| 43 | // |
| 44 | |
| 45 | |
| 46 | template <typename T> |
| 47 | struct is_recursive_flag |
| 48 | : mpl::false_ |
| 49 | { |
| 50 | }; |
| 51 | |
| 52 | template <typename T> |
| 53 | struct is_recursive_flag< recursive_flag<T> > |
| 54 | : mpl::true_ |
| 55 | { |
| 56 | }; |
| 57 | |
| 58 | |
| 59 | /////////////////////////////////////////////////////////////////////////////// |
| 60 | // (detail) metafunction enable_recursive |
| 61 | // |
| 62 | // Attempts recursive_variant_ tag substitution, wrapping with |
| 63 | // boost::recursive_wrapper if substituion occurs w/ non-indirect result |
| 64 | // (i.e., not a reference or pointer) *and* NoWrapper is false_. |
| 65 | // |
| 66 | template < |
| 67 | typename T |
| 68 | , typename RecursiveVariant |
| 69 | , typename NoWrapper = mpl::false_ |
| 70 | > |
| 71 | struct enable_recursive; |
| 72 | |
| 73 | /////////////////////////////////////////////////////////////////////////////// |
| 74 | // (detail) metafunction class quoted_enable_recursive |
| 75 | // |
| 76 | // Same behavior as enable_recursive metafunction (see above). |
| 77 | // |
| 78 | template < |
| 79 | typename RecursiveVariant |
| 80 | , typename NoWrapper = mpl::false_ |
| 81 | > |
| 82 | struct quoted_enable_recursive; |
| 83 | |
| 84 | }} // namespace detail::variant |
| 85 | } // namespace boost |
| 86 | |
| 87 | #endif // BOOST_VARIANT_DETAIL_ENABLE_RECURSIVE_FWD_HPP |
| 88 | |