sequence_base.hpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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/mpl/begin_end_fwd.hpp>
  10. namespace boost { namespace fusion
  11. {
  12. namespace detail
  13. {
  14. struct from_sequence_convertible_type
  15. {};
  16. }
  17. template <typename Sequence>
  18. struct sequence_base
  19. {
  20. Sequence const&
  21. derived() const
  22. {
  23. return static_cast<Sequence const&>(*this);
  24. }
  25. Sequence&
  26. derived()
  27. {
  28. return static_cast<Sequence&>(*this);
  29. }
  30. operator detail::from_sequence_convertible_type()const
  31. {
  32. return detail::from_sequence_convertible_type();
  33. }
  34. };
  35. struct fusion_sequence_tag;
  36. }}
  37. namespace boost { namespace mpl
  38. {
  39. // Deliberately break mpl::begin, so it doesn't lie that a Fusion sequence
  40. // is not an MPL sequence by returning mpl::void_.
  41. // In other words: Fusion Sequences are always MPL Sequences, but they can
  42. // be incompletely defined.
  43. template<> struct begin_impl< boost::fusion::fusion_sequence_tag >;
  44. }}
  45. #endif