fix doc example typo
[boost.git] / boost / mpl / sequence_tag.hpp
blobf87d92b28b5eba4e5bc4da503ec6907fa485cccc
2 #ifndef BOOST_MPL_SEQUENCE_TAG_HPP_INCLUDED
3 #define BOOST_MPL_SEQUENCE_TAG_HPP_INCLUDED
5 // Copyright Aleksey Gurtovoy 2000-2004
6 //
7 // Distributed under the Boost Software License, Version 1.0.
8 // (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
11 // See http://www.boost.org/libs/mpl for documentation.
13 // $Id$
14 // $Date$
15 // $Revision$
17 #include <boost/mpl/sequence_tag_fwd.hpp>
18 #include <boost/mpl/aux_/has_tag.hpp>
19 #include <boost/mpl/aux_/has_begin.hpp>
20 #include <boost/mpl/aux_/na_spec.hpp>
21 #include <boost/mpl/aux_/is_msvc_eti_arg.hpp>
22 #include <boost/mpl/aux_/config/eti.hpp>
23 #include <boost/mpl/aux_/yes_no.hpp>
24 #include <boost/mpl/aux_/config/workaround.hpp>
26 namespace boost { namespace mpl {
28 // agurt, 27/nov/02: have to use a simplistic 'sequence_tag' implementation
29 // on MSVC to avoid dreadful "internal structure overflow" error
30 #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
31 || defined(BOOST_MPL_CFG_NO_HAS_XXX)
33 template<
34 typename BOOST_MPL_AUX_NA_PARAM(Sequence)
36 struct sequence_tag
38 typedef typename Sequence::tag type;
41 #elif BOOST_WORKAROUND(BOOST_MSVC, == 1300)
43 // agurt, 07/feb/03: workaround for what seems to be MSVC 7.0-specific ETI issue
45 namespace aux {
47 template< bool >
48 struct sequence_tag_impl
50 template< typename Sequence > struct result_
52 typedef typename Sequence::tag type;
56 template<>
57 struct sequence_tag_impl<false>
59 template< typename Sequence > struct result_
61 typedef int type;
65 } // namespace aux
67 template<
68 typename BOOST_MPL_AUX_NA_PARAM(Sequence)
70 struct sequence_tag
71 : aux::sequence_tag_impl< !aux::is_msvc_eti_arg<Sequence>::value >
72 ::template result_<Sequence>
76 #else
78 namespace aux {
80 template< bool has_tag_, bool has_begin_ >
81 struct sequence_tag_impl
83 // agurt 24/nov/02: MSVC 6.5 gets confused in 'sequence_tag_impl<true>'
84 // specialization below, if we name it 'result_' here
85 template< typename Sequence > struct result2_;
88 # define AUX_CLASS_SEQUENCE_TAG_SPEC(has_tag, has_begin, result_type) \
89 template<> struct sequence_tag_impl<has_tag,has_begin> \
90 { \
91 template< typename Sequence > struct result2_ \
92 { \
93 typedef result_type type; \
94 }; \
95 }; \
96 /**/
98 AUX_CLASS_SEQUENCE_TAG_SPEC(true, true, typename Sequence::tag)
99 AUX_CLASS_SEQUENCE_TAG_SPEC(true, false, typename Sequence::tag)
100 AUX_CLASS_SEQUENCE_TAG_SPEC(false, true, nested_begin_end_tag)
101 AUX_CLASS_SEQUENCE_TAG_SPEC(false, false, non_sequence_tag)
103 # undef AUX_CLASS_SEQUENCE_TAG_SPEC
105 } // namespace aux
107 template<
108 typename BOOST_MPL_AUX_NA_PARAM(Sequence)
110 struct sequence_tag
111 : aux::sequence_tag_impl<
112 ::boost::mpl::aux::has_tag<Sequence>::value
113 , ::boost::mpl::aux::has_begin<Sequence>::value
114 >::template result2_<Sequence>
118 #endif // BOOST_MSVC
120 BOOST_MPL_AUX_NA_SPEC(1, sequence_tag)
124 #endif // BOOST_MPL_SEQUENCE_TAG_HPP_INCLUDED