sequence_base.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Copyright (c) 2007 Tobias Schwinger
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #if !defined(FUSION_SEQUENCE_BASE_04182005_0737)
  8. #define FUSION_SEQUENCE_BASE_04182005_0737
  9. #include <boost/config.hpp>
  10. #include <boost/fusion/support/config.hpp>
  11. #include <boost/mpl/begin_end_fwd.hpp>
  12. namespace boost { namespace fusion
  13. {
  14. namespace detail
  15. {
  16. struct from_sequence_convertible_type
  17. {};
  18. }
  19. template <typename Sequence>
  20. struct sequence_base
  21. {
  22. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  23. Sequence const&
  24. derived() const BOOST_NOEXCEPT
  25. {
  26. return static_cast<Sequence const&>(*this);
  27. }
  28. BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  29. Sequence&
  30. derived() BOOST_NOEXCEPT
  31. {
  32. return static_cast<Sequence&>(*this);
  33. }
  34. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  35. operator detail::from_sequence_convertible_type() const BOOST_NOEXCEPT
  36. {
  37. return detail::from_sequence_convertible_type();
  38. }
  39. };
  40. struct fusion_sequence_tag;
  41. }}
  42. namespace boost { namespace mpl
  43. {
  44. // Deliberately break mpl::begin, so it doesn't lie that a Fusion sequence
  45. // is not an MPL sequence by returning mpl::void_.
  46. // In other words: Fusion Sequences are always MPL Sequences, but they can
  47. // be incompletely defined.
  48. template<> struct begin_impl< boost::fusion::fusion_sequence_tag >;
  49. }}
  50. #endif