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/fusion/support/config.hpp>
11 #include <boost/utility/enable_if.hpp>
12 #include <boost/mpl/empty_base.hpp>
13 #include <boost/mpl/if.hpp>
14 #include <boost/fusion/sequence/intrinsic_fwd.hpp>
15 #include <boost/fusion/support/tag_of.hpp>
16 #include <boost/fusion/support/is_sequence.hpp>
17 #include <boost/fusion/support/is_segmented.hpp>
18 #include <boost/fusion/sequence/intrinsic/detail/segmented_end.hpp>
20 namespace boost { namespace fusion
23 struct sequence_facade_tag;
24 struct boost_tuple_tag; // boost::tuples::tuple tag
25 struct boost_array_tag; // boost::array tag
26 struct mpl_sequence_tag; // mpl sequence tag
27 struct std_pair_tag; // std::pair tag
31 template <typename Tag>
34 template <typename Sequence>
37 traits::is_segmented<Sequence>
38 , detail::segmented_end<Sequence>
45 struct end_impl<sequence_facade_tag>
47 template <typename Sequence>
48 struct apply : Sequence::template end<Sequence> {};
52 struct end_impl<boost_tuple_tag>;
55 struct end_impl<boost_array_tag>;
58 struct end_impl<mpl_sequence_tag>;
61 struct end_impl<std_pair_tag>;
66 template <typename Sequence>
68 : extension::end_impl<typename detail::tag_of<Sequence>::type>::
69 template apply<Sequence>
73 template <typename Sequence>
74 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
77 traits::is_sequence<Sequence>
78 , result_of::end<Sequence>
82 return result_of::end<Sequence>::call(seq);
85 template <typename Sequence>
86 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
89 traits::is_sequence<Sequence>
90 , result_of::end<Sequence const>
92 end(Sequence const& seq)
94 return result_of::end<Sequence const>::call(seq);