iterator_util: Make Reverse constexpr
C++17 makes non-member rbegin(), rend(), crbegin(), and crend() constexpr, allowing this to also be constexpr.
This commit is contained in:
parent
ab9b5fb8aa
commit
744495e23d
1 changed files with 3 additions and 3 deletions
|
@ -15,12 +15,12 @@ template<typename T>
|
|||
struct ReverseAdapter {
|
||||
T& iterable;
|
||||
|
||||
auto begin() {
|
||||
constexpr auto begin() {
|
||||
using namespace std;
|
||||
return rbegin(iterable);
|
||||
}
|
||||
|
||||
auto end() {
|
||||
constexpr auto end() {
|
||||
using namespace std;
|
||||
return rend(iterable);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ struct ReverseAdapter {
|
|||
} // namespace detail
|
||||
|
||||
template<typename T>
|
||||
detail::ReverseAdapter<T> Reverse(T&& iterable) {
|
||||
constexpr detail::ReverseAdapter<T> Reverse(T&& iterable) {
|
||||
return detail::ReverseAdapter<T>{iterable};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue