PageRenderTime 19ms CodeModel.GetById 14ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/Src/Dependencies/Boost/boost/range/adaptor/indirected.hpp

http://hadesmem.googlecode.com/
C++ Header | 88 lines | 65 code | 14 blank | 9 comment | 0 complexity | a7a1d1265ad8c759ad95be29cc0ff51e MD5 | raw file
 1// Boost.Range library
 2//
 3//  Copyright Thorsten Ottosen, Neil Groves 2006 - 2008. Use, modification and
 4//  distribution is subject to the Boost Software License, Version
 5//  1.0. (See accompanying file LICENSE_1_0.txt or copy at
 6//  http://www.boost.org/LICENSE_1_0.txt)
 7//
 8// For more information, see http://www.boost.org/libs/range/
 9//
10
11#ifndef BOOST_RANGE_ADAPTOR_INDIRECTED_HPP
12#define BOOST_RANGE_ADAPTOR_INDIRECTED_HPP
13
14#include <boost/range/iterator_range.hpp>
15#include <boost/iterator/indirect_iterator.hpp>
16
17namespace boost
18{
19    namespace range_detail
20    {
21        template< class R >
22        struct indirected_range :
23            public boost::iterator_range<
24                        boost::indirect_iterator<
25                            BOOST_DEDUCED_TYPENAME range_iterator<R>::type
26                        >
27                    >
28        {
29        private:
30            typedef boost::iterator_range<
31                        boost::indirect_iterator<
32                            BOOST_DEDUCED_TYPENAME range_iterator<R>::type
33                        >
34                    >
35                base;
36
37        public:
38            explicit indirected_range( R& r )
39                : base( r )
40            { }
41        };
42
43        struct indirect_forwarder {};
44
45        template< class InputRng >
46        inline indirected_range<InputRng>
47        operator|( InputRng& r, indirect_forwarder )
48        {
49            return indirected_range<InputRng>( r );
50        }
51
52        template< class InputRng >
53        inline indirected_range<const InputRng>
54        operator|( const InputRng& r, indirect_forwarder )
55        {
56            return indirected_range<const InputRng>( r );
57        }
58
59    } // 'range_detail'
60
61    using range_detail::indirected_range;
62
63    namespace adaptors
64    {
65        namespace
66        {
67            const range_detail::indirect_forwarder indirected =
68                                            range_detail::indirect_forwarder();
69        }
70
71        template<class InputRange>
72        inline indirected_range<InputRange>
73        indirect(InputRange& rng)
74        {
75            return indirected_range<InputRange>(rng);
76        }
77
78        template<class InputRange>
79        inline indirected_range<const InputRange>
80        indirect(const InputRange& rng)
81        {
82            return indirected_range<const InputRange>(rng);
83        }
84    } // 'adaptors'
85
86}
87
88#endif