Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:48:04

0001 
0002 #ifndef BOOST_MPL_SEQUENCE_TAG_HPP_INCLUDED
0003 #define BOOST_MPL_SEQUENCE_TAG_HPP_INCLUDED
0004 
0005 // Copyright Aleksey Gurtovoy 2000-2004
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. 
0008 // (See accompanying file LICENSE_1_0.txt or copy at 
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 //
0011 // See http://www.boost.org/libs/mpl for documentation.
0012 
0013 // $Id$
0014 // $Date$
0015 // $Revision$
0016 
0017 #include <boost/mpl/sequence_tag_fwd.hpp>
0018 #include <boost/mpl/aux_/has_tag.hpp>
0019 #include <boost/mpl/aux_/has_begin.hpp>
0020 #include <boost/mpl/aux_/na_spec.hpp>
0021 #include <boost/mpl/aux_/is_msvc_eti_arg.hpp>
0022 #include <boost/mpl/aux_/config/eti.hpp>
0023 #include <boost/mpl/aux_/yes_no.hpp>
0024 #include <boost/mpl/aux_/config/workaround.hpp>
0025 
0026 namespace boost { namespace mpl {
0027 
0028 // agurt, 27/nov/02: have to use a simplistic 'sequence_tag' implementation
0029 // on MSVC to avoid dreadful "internal structure overflow" error
0030 #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
0031     || defined(BOOST_MPL_CFG_NO_HAS_XXX)
0032 
0033 template<
0034       typename BOOST_MPL_AUX_NA_PARAM(Sequence)
0035     >
0036 struct sequence_tag
0037 {
0038     typedef typename Sequence::tag type;
0039 };
0040 
0041 #elif BOOST_WORKAROUND(BOOST_MSVC, == 1300)
0042 
0043 // agurt, 07/feb/03: workaround for what seems to be MSVC 7.0-specific ETI issue
0044 
0045 namespace aux {
0046 
0047 template< bool >
0048 struct sequence_tag_impl
0049 {
0050     template< typename Sequence > struct result_
0051     {
0052         typedef typename Sequence::tag type;
0053     };
0054 };
0055 
0056 template<>
0057 struct sequence_tag_impl<false>
0058 {
0059     template< typename Sequence > struct result_
0060     {
0061         typedef int type;
0062     };
0063 };
0064 
0065 } // namespace aux
0066 
0067 template<
0068       typename BOOST_MPL_AUX_NA_PARAM(Sequence)
0069     >
0070 struct sequence_tag
0071     : aux::sequence_tag_impl< !aux::is_msvc_eti_arg<Sequence>::value >
0072         ::template result_<Sequence>
0073 {
0074 };
0075 
0076 #else
0077 
0078 namespace aux {
0079 
0080 template< bool has_tag_, bool has_begin_ >
0081 struct sequence_tag_impl
0082 {
0083     // agurt 24/nov/02: MSVC 6.5 gets confused in 'sequence_tag_impl<true>' 
0084     // specialization below, if we name it 'result_' here
0085     template< typename Sequence > struct result2_;
0086 };
0087 
0088 #   define AUX_CLASS_SEQUENCE_TAG_SPEC(has_tag, has_begin, result_type) \
0089 template<> struct sequence_tag_impl<has_tag,has_begin> \
0090 { \
0091     template< typename Sequence > struct result2_ \
0092     { \
0093         typedef result_type type; \
0094     }; \
0095 }; \
0096 /**/
0097 
0098 AUX_CLASS_SEQUENCE_TAG_SPEC(true, true, typename Sequence::tag)
0099 AUX_CLASS_SEQUENCE_TAG_SPEC(true, false, typename Sequence::tag)
0100 AUX_CLASS_SEQUENCE_TAG_SPEC(false, true, nested_begin_end_tag)
0101 AUX_CLASS_SEQUENCE_TAG_SPEC(false, false, non_sequence_tag)
0102 
0103 #   undef AUX_CLASS_SEQUENCE_TAG_SPEC
0104 
0105 } // namespace aux
0106 
0107 template<
0108       typename BOOST_MPL_AUX_NA_PARAM(Sequence)
0109     >
0110 struct sequence_tag
0111     : aux::sequence_tag_impl<
0112           ::boost::mpl::aux::has_tag<Sequence>::value
0113         , ::boost::mpl::aux::has_begin<Sequence>::value
0114         >::template result2_<Sequence>
0115 {
0116 };
0117 
0118 #endif // BOOST_MSVC
0119 
0120 BOOST_MPL_AUX_NA_SPEC(1, sequence_tag)
0121 
0122 }}
0123 
0124 #endif // BOOST_MPL_SEQUENCE_TAG_HPP_INCLUDED