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_BEGIN_04052005_1132)
8 #define FUSION_BEGIN_04052005_1132
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_begin.hpp>
19 namespace boost { namespace fusion
22 struct sequence_facade_tag; // iterator 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_begin<Sequence>
44 struct begin_impl<sequence_facade_tag>
46 template <typename Sequence>
47 struct apply : Sequence::template begin<Sequence> {};
51 struct begin_impl<boost_tuple_tag>;
54 struct begin_impl<boost_array_tag>;
57 struct begin_impl<mpl_sequence_tag>;
60 struct begin_impl<std_pair_tag>;
65 template <typename Sequence>
67 : extension::begin_impl<typename detail::tag_of<Sequence>::type>::
68 template apply<Sequence>
72 template <typename Sequence>
75 traits::is_sequence<Sequence>
76 , result_of::begin<Sequence>
80 return result_of::begin<Sequence>::call(seq);
83 template <typename Sequence>
86 traits::is_sequence<Sequence>
87 , result_of::begin<Sequence const>
89 begin(Sequence const& seq)
91 return result_of::begin<Sequence const>::call(seq);