~twpol/dcplusplus/trunk

« back to all changes in this revision

Viewing changes to boost/boost/fusion/sequence/intrinsic/begin.hpp

  • Committer: James Ross
  • Date: 2010-07-05 00:03:18 UTC
  • mfrom: (1524.1.650 dcplusplus)
  • Revision ID: silver@warwickcompsoc.co.uk-20100705000318-awwqm8ocpp5m47yz
Merged to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*=============================================================================
2
 
    Copyright (c) 2001-2006 Joel de Guzman
3
 
 
4
 
    Distributed under the Boost Software License, Version 1.0. (See accompanying 
5
 
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6
 
==============================================================================*/
7
 
#if !defined(FUSION_BEGIN_04052005_1132)
8
 
#define FUSION_BEGIN_04052005_1132
9
 
 
10
 
#include <boost/fusion/support/tag_of.hpp>
11
 
 
12
 
namespace boost { namespace fusion
13
 
{
14
 
    // Special tags:
15
 
    struct sequence_facade_tag; // iterator facade tag
16
 
    struct boost_tuple_tag; // boost::tuples::tuple tag
17
 
    struct array_tag; // boost::array tag
18
 
    struct mpl_sequence_tag; // mpl sequence tag
19
 
    struct std_pair_tag; // std::pair tag
20
 
 
21
 
    namespace extension
22
 
    {
23
 
        template <typename Tag>
24
 
        struct begin_impl
25
 
        {
26
 
            template <typename Sequence>
27
 
            struct apply;
28
 
        };
29
 
 
30
 
        template <>
31
 
        struct begin_impl<sequence_facade_tag>
32
 
        {
33
 
            template <typename Sequence>
34
 
            struct apply : Sequence::template begin<Sequence> {};
35
 
        };
36
 
 
37
 
        template <>
38
 
        struct begin_impl<boost_tuple_tag>;
39
 
 
40
 
        template <>
41
 
        struct begin_impl<array_tag>;
42
 
 
43
 
        template <>
44
 
        struct begin_impl<mpl_sequence_tag>;
45
 
 
46
 
        template <>
47
 
        struct begin_impl<std_pair_tag>;
48
 
    }
49
 
 
50
 
    namespace result_of
51
 
    {
52
 
        template <typename Sequence>
53
 
        struct begin
54
 
            : extension::begin_impl<typename detail::tag_of<Sequence>::type>::
55
 
                template apply<Sequence>
56
 
        {};
57
 
    }
58
 
 
59
 
    template <typename Sequence>
60
 
    inline typename result_of::begin<Sequence>::type const
61
 
    begin(Sequence& seq)
62
 
    {
63
 
        return result_of::begin<Sequence>::call(seq);
64
 
    }
65
 
 
66
 
    template <typename Sequence>
67
 
    inline typename result_of::begin<Sequence const>::type const
68
 
    begin(Sequence const& seq)
69
 
    {
70
 
        return result_of::begin<Sequence const>::call(seq);
71
 
    }
72
 
}}
73
 
 
74
 
#endif
 
1
/*=============================================================================
 
2
    Copyright (c) 2001-2006 Joel de Guzman
 
3
 
 
4
    Distributed under the Boost Software License, Version 1.0. (See accompanying 
 
5
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
6
==============================================================================*/
 
7
#if !defined(FUSION_BEGIN_04052005_1132)
 
8
#define FUSION_BEGIN_04052005_1132
 
9
 
 
10
#include <boost/fusion/support/tag_of.hpp>
 
11
 
 
12
namespace boost { namespace fusion
 
13
{
 
14
    // Special tags:
 
15
    struct sequence_facade_tag; // iterator facade tag
 
16
    struct boost_tuple_tag; // boost::tuples::tuple tag
 
17
    struct array_tag; // boost::array tag
 
18
    struct mpl_sequence_tag; // mpl sequence tag
 
19
    struct std_pair_tag; // std::pair tag
 
20
 
 
21
    namespace extension
 
22
    {
 
23
        template <typename Tag>
 
24
        struct begin_impl
 
25
        {
 
26
            template <typename Sequence>
 
27
            struct apply;
 
28
        };
 
29
 
 
30
        template <>
 
31
        struct begin_impl<sequence_facade_tag>
 
32
        {
 
33
            template <typename Sequence>
 
34
            struct apply : Sequence::template begin<Sequence> {};
 
35
        };
 
36
 
 
37
        template <>
 
38
        struct begin_impl<boost_tuple_tag>;
 
39
 
 
40
        template <>
 
41
        struct begin_impl<array_tag>;
 
42
 
 
43
        template <>
 
44
        struct begin_impl<mpl_sequence_tag>;
 
45
 
 
46
        template <>
 
47
        struct begin_impl<std_pair_tag>;
 
48
    }
 
49
 
 
50
    namespace result_of
 
51
    {
 
52
        template <typename Sequence>
 
53
        struct begin
 
54
            : extension::begin_impl<typename detail::tag_of<Sequence>::type>::
 
55
                template apply<Sequence>
 
56
        {};
 
57
    }
 
58
 
 
59
    template <typename Sequence>
 
60
    inline typename result_of::begin<Sequence>::type const
 
61
    begin(Sequence& seq)
 
62
    {
 
63
        return result_of::begin<Sequence>::call(seq);
 
64
    }
 
65
 
 
66
    template <typename Sequence>
 
67
    inline typename result_of::begin<Sequence const>::type const
 
68
    begin(Sequence const& seq)
 
69
    {
 
70
        return result_of::begin<Sequence const>::call(seq);
 
71
    }
 
72
}}
 
73
 
 
74
#endif