Debian Codegraph @

3rd_party/range-v3/range/v3/action/reverse.hpp

raw
1 /// \file
2 // Range v3 library
3 //
4 // Copyright Eric Niebler 2013-present
5 // Copyright Gonzalo Brito Gadeschi 2017
6 //
7 // Use, modification and distribution is subject to the
8 // Boost Software License, Version 1.0. (See accompanying
9 // file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt)
11 //
12 // Project home: https://github.com/ericniebler/range-v3
13 //
14
15 #ifndef RANGES_V3_ACTION_REVERSE_HPP
16 #define RANGES_V3_ACTION_REVERSE_HPP
17
18 #include <range/v3/range_fwd.hpp>
19
20 #include <range/v3/action/action.hpp>
21 #include <range/v3/algorithm/reverse.hpp>
22 #include <range/v3/iterator/concepts.hpp>
23 #include <range/v3/range/traits.hpp>
24 #include <range/v3/utility/static_const.hpp>
25
26 #include <range/v3/detail/prologue.hpp>
27
28 namespace ranges
29 {
30 /// \addtogroup group-actions
31 /// @{
32 namespace actions
33 {
34 /// Reversed the source range in-place.
35 struct reverse_fn
36 {
37 template(typename Rng)(
38 requires bidirectional_range<Rng> AND permutable<iterator_t<Rng>>)
39 Rng operator()(Rng && rng) const
40 {
41 ranges::reverse(rng);
42 return static_cast<Rng &&>(rng);
43 }
44 };
45
46 /// \relates actions::reverse_fn
47 /// \sa action_closure
48 RANGES_INLINE_VARIABLE(action_closure<reverse_fn>, reverse)
49 } // namespace actions
50 /// @}
51 } // namespace ranges
52
53 #include <range/v3/detail/epilogue.hpp>
54
55 #endif