source: NonGTP/Boost/boost/mpl/set/aux_/iterator.hpp @ 857

Revision 857, 2.5 KB checked in by igarcia, 19 years ago (diff)
Line 
1
2#ifndef BOOST_MPL_SET_AUX_ITERATOR_HPP_INCLUDED
3#define BOOST_MPL_SET_AUX_ITERATOR_HPP_INCLUDED
4
5// Copyright Aleksey Gurtovoy 2003-2004
6// Copyright David Abrahams 2003-2004
7//
8// Distributed under the Boost Software License, Version 1.0.
9// (See accompanying file LICENSE_1_0.txt or copy at
10// http://www.boost.org/LICENSE_1_0.txt)
11//
12// See http://www.boost.org/libs/mpl for documentation.
13
14// $Source: /cvsroot/boost/boost/boost/mpl/set/aux_/iterator.hpp,v $
15// $Date: 2005/06/18 22:03:09 $
16// $Revision: 1.4 $
17
18#include <boost/mpl/set/aux_/set0.hpp>
19#include <boost/mpl/has_key.hpp>
20#include <boost/mpl/iterator_tags.hpp>
21#include <boost/mpl/next.hpp>
22#include <boost/mpl/eval_if.hpp>
23#include <boost/mpl/if.hpp>
24#include <boost/mpl/identity.hpp>
25#include <boost/mpl/aux_/config/ctps.hpp>
26
27namespace boost { namespace mpl {
28
29// used by 's_iter_impl'
30template< typename Set, typename Tail > struct s_iter;
31
32template< typename Set, typename Tail > struct s_iter_impl
33{
34    typedef Tail                        tail_;
35    typedef forward_iterator_tag        category;
36    typedef typename Tail::item_::type  type;
37
38#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
39    typedef typename eval_if<
40          has_key< Set,typename Tail::next_::type >
41        , identity< s_iter<Set,typename Tail::next_> >
42        , next< s_iter<Set,typename Tail::next_> >
43        >::type next;       
44#endif
45};
46
47#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
48
49template< typename Set, typename Tail >
50struct next< s_iter<Set,Tail> >
51    : eval_if<
52          has_key< Set,typename Tail::next_::type >
53        , identity< s_iter<Set,typename Tail::next_> >
54        , next< s_iter<Set,typename Tail::next_> >
55        >
56{
57};
58
59template< typename Set >
60struct next< s_iter<Set,set0<> > >
61{
62    typedef s_iter<Set,set0<> > type;
63};
64
65template< typename Set, typename Tail > struct s_iter
66    : s_iter_impl<Set,Tail>
67{
68};
69
70template< typename Set > struct s_iter<Set, set0<> >
71{
72    typedef forward_iterator_tag category;
73};
74
75#else
76
77template< typename Set >
78struct s_end_iter
79{
80    typedef forward_iterator_tag    category;
81    typedef s_iter<Set,set0<> >     next;
82};
83
84template< typename Set, typename Tail > struct s_iter
85    : if_<
86          is_same< Tail,set0<> >
87        , s_end_iter<Set>
88        , s_iter_impl<Set,Tail>
89        >::type
90{
91};
92
93#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
94
95}}
96
97#endif // BOOST_MPL_SET_AUX_ITERATOR_HPP_INCLUDED
Note: See TracBrowser for help on using the repository browser.