Horizon
Loading...
Searching...
No Matches
stable_sort.hpp
Go to the documentation of this file.
1
2// Range v3 library
3//
4// Copyright Eric Niebler 2013-present
5//
6// Use, modification and distribution is subject to the
7// Boost Software License, Version 1.0. (See accompanying
8// file LICENSE_1_0.txt or copy at
9// http://www.boost.org/LICENSE_1_0.txt)
10//
11// Project home: https://github.com/ericniebler/range-v3
12//
13
14#ifndef RANGES_V3_ACTION_STABLE_SORT_HPP
15#define RANGES_V3_ACTION_STABLE_SORT_HPP
16
18
26#include <range/v3/utility/static_const.hpp>
27
28#include <range/v3/detail/prologue.hpp>
29
30namespace ranges
31{
34 namespace actions
35 {
37 {
38 template(typename C, typename P = identity)(
39 requires (!range<C>))
40 constexpr auto operator()(C pred, P proj = P{}) const
41 {
42 return make_action_closure(
43 bind_back(stable_sort_fn{}, std::move(pred), std::move(proj)));
44 }
45
46 template(typename Rng, typename C = less, typename P = identity)(
48 Rng operator()(Rng && rng, C pred = C{}, P proj = P{}) const
49 {
50 ranges::stable_sort(rng, std::move(pred), std::move(proj));
51 return static_cast<Rng &&>(rng);
52 }
53 };
54
57 RANGES_INLINE_VARIABLE(action_closure<stable_sort_fn>, stable_sort)
58 } // namespace actions
60} // namespace ranges
61
62#include <range/v3/detail/epilogue.hpp>
63
64#endif
The forward_range concept.
The range concept.
The sortable concept.
decltype(begin(declval(Rng &))) iterator_t
Definition access.hpp:698
Definition action.hpp:141
Definition stable_sort.hpp:37
Definition identity.hpp:25
Definition comparisons.hpp:50