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