Chris@16
|
1 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
2 /// \file rbegin.hpp
|
Chris@16
|
3 /// Proto callables for boost::rbegin()
|
Chris@16
|
4 //
|
Chris@16
|
5 // Copyright 2012 Eric Niebler. Distributed under the Boost
|
Chris@16
|
6 // Software License, Version 1.0. (See accompanying file
|
Chris@16
|
7 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
8
|
Chris@16
|
9 #ifndef BOOST_PROTO_FUNCTIONAL_RANGE_RBEGIN_HPP_EAN_27_08_2012
|
Chris@16
|
10 #define BOOST_PROTO_FUNCTIONAL_RANGE_RBEGIN_HPP_EAN_27_08_2012
|
Chris@16
|
11
|
Chris@16
|
12 #include <boost/range/rbegin.hpp>
|
Chris@16
|
13 #include <boost/proto/proto_fwd.hpp>
|
Chris@16
|
14
|
Chris@16
|
15 namespace boost { namespace proto { namespace functional
|
Chris@16
|
16 {
|
Chris@16
|
17
|
Chris@16
|
18 // A PolymorphicFunctionObject that wraps boost::rbegin()
|
Chris@16
|
19 struct rbegin
|
Chris@16
|
20 {
|
Chris@16
|
21 BOOST_PROTO_CALLABLE()
|
Chris@16
|
22
|
Chris@16
|
23 template<typename Sig>
|
Chris@16
|
24 struct result;
|
Chris@16
|
25
|
Chris@16
|
26 template<typename This, typename Rng>
|
Chris@16
|
27 struct result<This(Rng)>
|
Chris@16
|
28 : boost::range_reverse_iterator<Rng const>
|
Chris@16
|
29 {};
|
Chris@16
|
30
|
Chris@16
|
31 template<typename This, typename Rng>
|
Chris@16
|
32 struct result<This(Rng &)>
|
Chris@16
|
33 : boost::range_reverse_iterator<Rng>
|
Chris@16
|
34 {};
|
Chris@16
|
35
|
Chris@16
|
36 template<typename Rng>
|
Chris@16
|
37 typename boost::range_reverse_iterator<Rng>::type operator()(Rng &rng) const
|
Chris@16
|
38 {
|
Chris@16
|
39 return boost::rbegin(rng);
|
Chris@16
|
40 }
|
Chris@16
|
41
|
Chris@16
|
42 template<typename Rng>
|
Chris@16
|
43 typename boost::range_reverse_iterator<Rng const>::type operator()(Rng const &rng) const
|
Chris@16
|
44 {
|
Chris@16
|
45 return boost::rbegin(rng);
|
Chris@16
|
46 }
|
Chris@16
|
47 };
|
Chris@16
|
48
|
Chris@16
|
49 }}}
|
Chris@16
|
50
|
Chris@16
|
51 #endif
|