enable_recursive_fwd.hpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. #ifndef BOOST_VARIANT_DETAIL_ENABLE_RECURSIVE_FWD_HPP
  13. #define BOOST_VARIANT_DETAIL_ENABLE_RECURSIVE_FWD_HPP
  14. #include <boost/mpl/aux_/config/ctps.hpp>
  15. #include <boost/mpl/bool_fwd.hpp>
  16. # include <boost/mpl/bool.hpp>
  17. namespace boost {
  18. namespace detail { namespace variant {
  19. ///////////////////////////////////////////////////////////////////////////////
  20. // (detail) tag recursive_flag
  21. //
  22. // Signifies that the variant should perform recursive substituion.
  23. //
  24. template <typename T>
  25. struct recursive_flag
  26. {
  27. typedef T type;
  28. };
  29. ///////////////////////////////////////////////////////////////////////////////
  30. // (detail) metafunction is_recursive_flag
  31. //
  32. // Signifies that the variant should perform recursive substituion.
  33. //
  34. template <typename T>
  35. struct is_recursive_flag
  36. : mpl::false_
  37. {
  38. };
  39. template <typename T>
  40. struct is_recursive_flag< recursive_flag<T> >
  41. : mpl::true_
  42. {
  43. };
  44. ///////////////////////////////////////////////////////////////////////////////
  45. // (detail) metafunction enable_recursive
  46. //
  47. // Attempts recursive_variant_ tag substitution, wrapping with
  48. // boost::recursive_wrapper if substituion occurs w/ non-indirect result
  49. // (i.e., not a reference or pointer) *and* NoWrapper is false_.
  50. //
  51. template <
  52. typename T
  53. , typename RecursiveVariant
  54. , typename NoWrapper = mpl::false_
  55. >
  56. struct enable_recursive;
  57. ///////////////////////////////////////////////////////////////////////////////
  58. // (detail) metafunction class quoted_enable_recursive
  59. //
  60. // Same behavior as enable_recursive metafunction (see above).
  61. //
  62. template <
  63. typename RecursiveVariant
  64. , typename NoWrapper = mpl::false_
  65. >
  66. struct quoted_enable_recursive;
  67. }} // namespace detail::variant
  68. } // namespace boost
  69. #endif // BOOST_VARIANT_DETAIL_ENABLE_RECURSIVE_FWD_HPP