2 #ifndef BOOST_MPL_AUX_BEGIN_END_IMPL_HPP_INCLUDED
\r
3 #define BOOST_MPL_AUX_BEGIN_END_IMPL_HPP_INCLUDED
\r
5 // Copyright Aleksey Gurtovoy 2000-2004
\r
7 // Distributed under the Boost Software License, Version 1.0.
\r
8 // (See accompanying file LICENSE_1_0.txt or copy at
\r
9 // http://www.boost.org/LICENSE_1_0.txt)
\r
11 // See http://www.boost.org/libs/mpl for documentation.
\r
13 // $Id: begin_end_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
\r
14 // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
\r
15 // $Revision: 49267 $
\r
17 #include <boost/mpl/begin_end_fwd.hpp>
\r
18 #include <boost/mpl/sequence_tag_fwd.hpp>
\r
19 #include <boost/mpl/void.hpp>
\r
20 #include <boost/mpl/eval_if.hpp>
\r
21 #include <boost/mpl/aux_/has_begin.hpp>
\r
22 #include <boost/mpl/aux_/na.hpp>
\r
23 #include <boost/mpl/aux_/traits_lambda_spec.hpp>
\r
24 #include <boost/mpl/aux_/config/eti.hpp>
\r
26 namespace boost { namespace mpl {
\r
31 template< typename Sequence >
\r
34 typedef typename Sequence::begin type;
\r
36 template< typename Sequence >
\r
39 typedef typename Sequence::end type;
\r
44 // default implementation; conrete sequences might override it by
\r
45 // specializing either the 'begin_impl/end_impl' or the primary
\r
46 // 'begin/end' templates
\r
48 template< typename Tag >
\r
51 template< typename Sequence > struct apply
\r
53 typedef typename eval_if<aux::has_begin<Sequence, true_>,
\r
54 aux::begin_type<Sequence>, void_>::type type;
\r
58 template< typename Tag >
\r
61 template< typename Sequence > struct apply
\r
63 typedef typename eval_if<aux::has_begin<Sequence, true_>,
\r
64 aux::end_type<Sequence>, void_>::type type;
\r
68 // specialize 'begin_trait/end_trait' for two pre-defined tags
\r
70 # define AUX778076_IMPL_SPEC(name, tag, result) \
\r
72 struct name##_impl<tag> \
\r
74 template< typename Sequence > struct apply \
\r
76 typedef result type; \
\r
81 // a sequence with nested 'begin/end' typedefs; just query them
\r
82 AUX778076_IMPL_SPEC(begin, nested_begin_end_tag, typename Sequence::begin)
\r
83 AUX778076_IMPL_SPEC(end, nested_begin_end_tag, typename Sequence::end)
\r
85 // if a type 'T' does not contain 'begin/end' or 'tag' members
\r
86 // and doesn't specialize either 'begin/end' or 'begin_impl/end_impl'
\r
87 // templates, then we end up here
\r
88 AUX778076_IMPL_SPEC(begin, non_sequence_tag, void_)
\r
89 AUX778076_IMPL_SPEC(end, non_sequence_tag, void_)
\r
90 AUX778076_IMPL_SPEC(begin, na, void_)
\r
91 AUX778076_IMPL_SPEC(end, na, void_)
\r
93 # undef AUX778076_IMPL_SPEC
\r
96 BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC_IMPL(1,begin_impl)
\r
97 BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC_IMPL(1,end_impl)
\r
101 #endif // BOOST_MPL_AUX_BEGIN_END_IMPL_HPP_INCLUDED
\r