From 744495e23dc2ebad857bf4f0803a04846d0ab499 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 31 Jan 2018 10:01:55 -0500 Subject: [PATCH] iterator_util: Make Reverse constexpr C++17 makes non-member rbegin(), rend(), crbegin(), and crend() constexpr, allowing this to also be constexpr. --- src/common/iterator_util.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/iterator_util.h b/src/common/iterator_util.h index f95fc165..c35cc15b 100644 --- a/src/common/iterator_util.h +++ b/src/common/iterator_util.h @@ -15,12 +15,12 @@ template 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 -detail::ReverseAdapter Reverse(T&& iterable) { +constexpr detail::ReverseAdapter Reverse(T&& iterable) { return detail::ReverseAdapter{iterable}; }