/Src/Dependencies/Boost/boost/fusion/sequence/intrinsic/end.hpp

http://hadesmem.googlecode.com/ · C++ Header · 84 lines · 65 code · 12 blank · 7 comment · 0 complexity · cc670ff61a856a3cee072d5a13f57708 MD5 · raw file

  1. /*=============================================================================
  2. Copyright (c) 2001-2006 Joel de Guzman
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. ==============================================================================*/
  6. #if !defined(FUSION_END_04052005_1141)
  7. #define FUSION_END_04052005_1141
  8. #include <boost/fusion/support/tag_of.hpp>
  9. #include <boost/fusion/support/is_sequence.hpp>
  10. #include <boost/utility/enable_if.hpp>
  11. namespace boost { namespace fusion
  12. {
  13. // Special tags:
  14. struct sequence_facade_tag;
  15. struct boost_tuple_tag; // boost::tuples::tuple tag
  16. struct boost_array_tag; // boost::array tag
  17. struct mpl_sequence_tag; // mpl sequence tag
  18. struct std_pair_tag; // std::pair tag
  19. namespace extension
  20. {
  21. template <typename Tag>
  22. struct end_impl
  23. {
  24. template <typename Sequence>
  25. struct apply;
  26. };
  27. template <>
  28. struct end_impl<sequence_facade_tag>
  29. {
  30. template <typename Sequence>
  31. struct apply : Sequence::template end<Sequence> {};
  32. };
  33. template <>
  34. struct end_impl<boost_tuple_tag>;
  35. template <>
  36. struct end_impl<boost_array_tag>;
  37. template <>
  38. struct end_impl<mpl_sequence_tag>;
  39. template <>
  40. struct end_impl<std_pair_tag>;
  41. }
  42. namespace result_of
  43. {
  44. template <typename Sequence>
  45. struct end
  46. : extension::end_impl<typename detail::tag_of<Sequence>::type>::
  47. template apply<Sequence>
  48. {};
  49. }
  50. template <typename Sequence>
  51. inline typename
  52. lazy_enable_if<
  53. traits::is_sequence<Sequence>
  54. , result_of::end<Sequence>
  55. >::type const
  56. end(Sequence& seq)
  57. {
  58. return result_of::end<Sequence>::call(seq);
  59. }
  60. template <typename Sequence>
  61. inline typename
  62. lazy_enable_if<
  63. traits::is_sequence<Sequence>
  64. , result_of::end<Sequence const>
  65. >::type const
  66. end(Sequence const& seq)
  67. {
  68. return result_of::end<Sequence const>::call(seq);
  69. }
  70. }}
  71. #endif