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:
Lioncash 2018-01-31 10:01:55 -05:00 committed by MerryMage
parent ab9b5fb8aa
commit 744495e23d

View file

@ -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};
}