~ubuntu-branches/ubuntu/warty/aqsis/warty

« back to all changes in this revision

Viewing changes to boost/boost/mpl/sequence_tag.hpp

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-08-24 07:25:04 UTC
  • Revision ID: james.westby@ubuntu.com-20040824072504-zf993vnevvisdsvb
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//-----------------------------------------------------------------------------
 
2
// boost mpl/sequence_tag.hpp header file
 
3
// See http://www.boost.org for updates, documentation, and revision history.
 
4
//-----------------------------------------------------------------------------
 
5
//
 
6
// Copyright (c) 2000-02
 
7
// Aleksey Gurtovoy
 
8
//
 
9
// Permission to use, copy, modify, distribute and sell this software
 
10
// and its documentation for any purpose is hereby granted without fee, 
 
11
// provided that the above copyright notice appears in all copies and 
 
12
// that both the copyright notice and this permission notice appear in 
 
13
// supporting documentation. No representations are made about the 
 
14
// suitability of this software for any purpose. It is provided "as is" 
 
15
// without express or implied warranty.
 
16
 
 
17
#ifndef BOOST_MPL_SEQUENCE_TAG_HPP_INCLUDED
 
18
#define BOOST_MPL_SEQUENCE_TAG_HPP_INCLUDED
 
19
 
 
20
#include "boost/mpl/sequence_tag_fwd.hpp"
 
21
#include "boost/mpl/aux_/has_tag.hpp"
 
22
#include "boost/mpl/aux_/has_begin.hpp"
 
23
#include "boost/mpl/aux_/void_spec.hpp"
 
24
#include "boost/mpl/aux_/is_msvc_eti_arg.hpp"
 
25
#include "boost/mpl/aux_/config/eti.hpp"
 
26
#include "boost/mpl/aux_/yes_no.hpp"
 
27
#include "boost/mpl/aux_/config/workaround.hpp"
 
28
 
 
29
namespace boost { namespace mpl {
 
30
 
 
31
// agurt, 27/nov/02: have to use a simplistic 'sequence_tag' implementation
 
32
// on MSVC to avoid dreadful "internal structure overflow" error
 
33
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
 
34
 
 
35
template<
 
36
      typename BOOST_MPL_AUX_VOID_SPEC_PARAM(Sequence)
 
37
    >
 
38
struct sequence_tag
 
39
{
 
40
    typedef typename Sequence::tag type;
 
41
};
 
42
 
 
43
#elif BOOST_WORKAROUND(BOOST_MSVC, == 1300)
 
44
 
 
45
// agurt, 07/feb/03: workaround for what seems to be MSVC 7.0-specific ETI issue
 
46
 
 
47
namespace aux {
 
48
 
 
49
template< bool >
 
50
struct sequence_tag_impl
 
51
{
 
52
    template< typename Sequence > struct result_
 
53
    {
 
54
        typedef typename Sequence::tag type;
 
55
    };
 
56
};
 
57
 
 
58
template<>
 
59
struct sequence_tag_impl<false>
 
60
{
 
61
    template< typename Sequence > struct result_
 
62
    {
 
63
        typedef int type;
 
64
    };
 
65
};
 
66
 
 
67
} // namespace aux
 
68
 
 
69
template<
 
70
      typename BOOST_MPL_AUX_VOID_SPEC_PARAM(Sequence)
 
71
    >
 
72
struct sequence_tag
 
73
    : aux::sequence_tag_impl< !aux::is_msvc_eti_arg<Sequence>::value >
 
74
        ::template result_<Sequence>
 
75
{
 
76
};
 
77
 
 
78
#else
 
79
 
 
80
namespace aux {
 
81
 
 
82
template< bool has_tag_, bool has_begin_ >
 
83
struct sequence_tag_impl
 
84
{
 
85
    // agurt 24/nov/02: MSVC 6.5 gets confused in 'sequence_tag_impl<true>' 
 
86
    // specialization below, if we name it 'result_' here
 
87
    template< typename Sequence > struct result2_;
 
88
};
 
89
 
 
90
#   define AUX_CLASS_SEQUENCE_TAG_SPEC(has_tag, has_begin, result_type) \
 
91
template<> struct sequence_tag_impl<has_tag,has_begin> \
 
92
{ \
 
93
    template< typename Sequence > struct result2_ \
 
94
    { \
 
95
        typedef result_type type; \
 
96
    }; \
 
97
}; \
 
98
/**/
 
99
 
 
100
AUX_CLASS_SEQUENCE_TAG_SPEC(true, true, typename Sequence::tag)
 
101
AUX_CLASS_SEQUENCE_TAG_SPEC(true, false, typename Sequence::tag)
 
102
AUX_CLASS_SEQUENCE_TAG_SPEC(false, true, nested_begin_end_tag)
 
103
AUX_CLASS_SEQUENCE_TAG_SPEC(false, false, non_sequence_tag)
 
104
 
 
105
#   undef AUX_CLASS_SEQUENCE_TAG_SPEC
 
106
 
 
107
} // namespace aux
 
108
 
 
109
template<
 
110
      typename BOOST_MPL_AUX_VOID_SPEC_PARAM(Sequence)
 
111
    >
 
112
struct sequence_tag
 
113
    : aux::sequence_tag_impl<
 
114
          ::boost::mpl::aux::has_tag<Sequence>::value
 
115
        , ::boost::mpl::aux::has_begin<Sequence>::value
 
116
        >::template result2_<Sequence>
 
117
{
 
118
};
 
119
 
 
120
#endif // BOOST_MSVC
 
121
 
 
122
#if defined(BOOST_MPL_MSVC_60_ETI_BUG)
 
123
template<> struct sequence_tag<int>
 
124
{
 
125
    typedef int type;
 
126
};
 
127
#endif
 
128
 
 
129
BOOST_MPL_AUX_VOID_SPEC(1, sequence_tag)
 
130
 
 
131
}} // namespace boost::mpl
 
132
 
 
133
#endif // BOOST_MPL_SEQUENCE_TAG_HPP_INCLUDED