Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:02:09

0001 //-----------------------------------------------------------------------------
0002 // boost variant/detail/enable_recursive.hpp header file
0003 // See http://www.boost.org for updates, documentation, and revision history.
0004 //-----------------------------------------------------------------------------
0005 //
0006 // Copyright (c) 2003
0007 // Eric Friedman
0008 //
0009 // Distributed under the Boost Software License, Version 1.0. (See
0010 // accompanying file LICENSE_1_0.txt or copy at
0011 // http://www.boost.org/LICENSE_1_0.txt)
0012 
0013 #ifndef BOOST_VARIANT_DETAIL_ENABLE_RECURSIVE_HPP
0014 #define BOOST_VARIANT_DETAIL_ENABLE_RECURSIVE_HPP
0015 
0016 #include <boost/variant/detail/enable_recursive_fwd.hpp>
0017 #include <boost/variant/variant_fwd.hpp>
0018 
0019 #if !defined(BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT)
0020 #   include <boost/mpl/apply.hpp>
0021 #   include <boost/mpl/eval_if.hpp>
0022 #   include <boost/mpl/lambda.hpp>
0023 #endif
0024 
0025 #include <boost/variant/detail/substitute.hpp>
0026 #include <boost/mpl/aux_/config/ctps.hpp>
0027 #include <boost/mpl/bool_fwd.hpp>
0028 #include <boost/mpl/if.hpp>
0029 #include <boost/mpl/or.hpp>
0030 #include <boost/type_traits/is_pointer.hpp>
0031 #include <boost/type_traits/is_reference.hpp>
0032 #include <boost/type_traits/is_same.hpp>
0033 
0034 #include <boost/variant/recursive_wrapper.hpp>
0035 
0036 namespace boost {
0037 namespace detail { namespace variant {
0038 
0039 #   define BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL(T,Dest,Source) \
0040     substitute< T , Dest , Source > \
0041     /**/
0042 
0043 ///////////////////////////////////////////////////////////////////////////////
0044 // (detail) metafunction enable_recursive
0045 //
0046 // See boost/variant/detail/enable_recursive_fwd.hpp for more information.
0047 //
0048 
0049 
0050 template <typename T, typename RecursiveVariant, typename NoWrapper>
0051 struct enable_recursive
0052     : BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL(
0053           T, RecursiveVariant, ::boost::recursive_variant_
0054         )
0055 {
0056 };
0057 
0058 template <typename T, typename RecursiveVariant>
0059 struct enable_recursive< T,RecursiveVariant,mpl::false_ >
0060 {
0061 private: // helpers, for metafunction result (below)
0062 
0063     typedef typename BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL(
0064           T, RecursiveVariant, ::boost::recursive_variant_
0065         )::type t_;
0066 
0067 public: // metafunction result
0068 
0069     // [Wrap with recursive_wrapper only if rebind really changed something:]
0070     typedef typename mpl::if_<
0071           mpl::or_<
0072               is_same< t_,T >
0073             , is_reference<t_>
0074             , is_pointer<t_>
0075             >
0076         , t_
0077         , boost::recursive_wrapper<t_>
0078         >::type type;
0079 
0080 };
0081 
0082 
0083 ///////////////////////////////////////////////////////////////////////////////
0084 // (detail) metafunction class quoted_enable_recursive
0085 //
0086 // Same behavior as enable_recursive metafunction (see above).
0087 //
0088 template <typename RecursiveVariant, typename NoWrapper>
0089 struct quoted_enable_recursive
0090 {
0091     template <typename T>
0092     struct apply
0093         : enable_recursive<T, RecursiveVariant, NoWrapper>
0094     {
0095     };
0096 };
0097 
0098 }} // namespace detail::variant
0099 } // namespace boost
0100 
0101 #endif // BOOST_VARIANT_DETAIL_ENABLE_RECURSIVE_HPP