1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
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_END_04052005_1141)
8 #define FUSION_END_04052005_1141
10 #include <boost/blank.hpp>
11 #include <boost/utility/enable_if.hpp>
12 #include <boost/mpl/if.hpp>
13 #include <boost/fusion/sequence/intrinsic_fwd.hpp>
14 #include <boost/fusion/support/tag_of.hpp>
15 #include <boost/fusion/support/is_sequence.hpp>
16 #include <boost/fusion/support/is_segmented.hpp>
17 #include <boost/fusion/sequence/intrinsic/detail/segmented_end.hpp>
19 namespace boost { namespace fusion
22 struct sequence_facade_tag;
23 struct boost_tuple_tag; // boost::tuples::tuple tag
24 struct boost_array_tag; // boost::array tag
25 struct mpl_sequence_tag; // mpl sequence tag
26 struct std_pair_tag; // std::pair tag
30 template <typename Tag>
33 template <typename Sequence>
36 traits::is_segmented<Sequence>
37 , detail::segmented_end<Sequence>
44 struct end_impl<sequence_facade_tag>
46 template <typename Sequence>
47 struct apply : Sequence::template end<Sequence> {};
51 struct end_impl<boost_tuple_tag>;
54 struct end_impl<boost_array_tag>;
57 struct end_impl<mpl_sequence_tag>;
60 struct end_impl<std_pair_tag>;
65 template <typename Sequence>
67 : extension::end_impl<typename detail::tag_of<Sequence>::type>::
68 template apply<Sequence>
72 template <typename Sequence>
75 traits::is_sequence<Sequence>
76 , result_of::end<Sequence>
80 return result_of::end<Sequence>::call(seq);
83 template <typename Sequence>
86 traits::is_sequence<Sequence>
87 , result_of::end<Sequence const>
89 end(Sequence const& seq)
91 return result_of::end<Sequence const>::call(seq);