]> AND Private Git Repository - canny.git/blob - stc/exp/ml_stc_linux_make_v1.0/include/boost/mpl/aux_/begin_end_impl.hpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
638312bfce68c17b2a46addec955a695839f19c6
[canny.git] / stc / exp / ml_stc_linux_make_v1.0 / include / boost / mpl / aux_ / begin_end_impl.hpp
1 \r
2 #ifndef BOOST_MPL_AUX_BEGIN_END_IMPL_HPP_INCLUDED\r
3 #define BOOST_MPL_AUX_BEGIN_END_IMPL_HPP_INCLUDED\r
4 \r
5 // Copyright Aleksey Gurtovoy 2000-2004\r
6 //\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
10 //\r
11 // See http://www.boost.org/libs/mpl for documentation.\r
12 \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
16 \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
25 \r
26 namespace boost { namespace mpl {\r
27 \r
28 \r
29 namespace aux { \r
30 \r
31 template< typename Sequence > \r
32 struct begin_type \r
33\r
34     typedef typename Sequence::begin type; \r
35 };\r
36 template< typename Sequence > \r
37 struct end_type\r
38\r
39     typedef typename Sequence::end type; \r
40 };\r
41 \r
42 }\r
43 \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
47 \r
48 template< typename Tag >\r
49 struct begin_impl\r
50 {\r
51     template< typename Sequence > struct apply\r
52     {\r
53         typedef typename eval_if<aux::has_begin<Sequence, true_>,\r
54                                  aux::begin_type<Sequence>, void_>::type type;\r
55     };\r
56 };\r
57 \r
58 template< typename Tag >\r
59 struct end_impl\r
60 {\r
61     template< typename Sequence > struct apply\r
62     {\r
63         typedef typename eval_if<aux::has_begin<Sequence, true_>,\r
64                                  aux::end_type<Sequence>, void_>::type type;\r
65     };\r
66 };\r
67 \r
68 // specialize 'begin_trait/end_trait' for two pre-defined tags\r
69 \r
70 #   define AUX778076_IMPL_SPEC(name, tag, result) \\r
71 template<> \\r
72 struct name##_impl<tag> \\r
73 { \\r
74     template< typename Sequence > struct apply \\r
75     { \\r
76         typedef result type; \\r
77     }; \\r
78 }; \\r
79 /**/\r
80 \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
84 \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
92 \r
93 #   undef AUX778076_IMPL_SPEC\r
94 \r
95 \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
98 \r
99 }}\r
100 \r
101 #endif // BOOST_MPL_AUX_BEGIN_END_IMPL_HPP_INCLUDED\r