From 5634e59dc5d122215aad7aa22aa6042258411a10 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Tue, 1 Aug 2017 14:47:44 +1000 Subject: [PATCH] view: don't return references to iterators we emulate string_view behaviour. modifying our iterators behind our backs isn't a great way to ensure invariants are kept. --- view.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/view.hpp b/view.hpp index 3b893c1e..718a758f 100644 --- a/view.hpp +++ b/view.hpp @@ -51,14 +51,14 @@ namespace util { m_end (std::end (klass)) { ; } - constexpr T& begin (void) noexcept { return m_begin; } - constexpr T& end (void) noexcept { return m_end; } + constexpr T begin (void) noexcept { return m_begin; } + constexpr T end (void) noexcept { return m_end; } - constexpr const T& begin (void) const noexcept { return cbegin (); } - constexpr const T& end (void) const noexcept { return cend (); } + constexpr const T begin (void) const noexcept { return cbegin (); } + constexpr const T end (void) const noexcept { return cend (); } - constexpr const T& cbegin (void) const noexcept { return m_begin; } - constexpr const T& cend (void) const noexcept { return m_end; } + constexpr const T cbegin (void) const noexcept { return m_begin; } + constexpr const T cend (void) const noexcept { return m_end; } auto data (void) { return begin (); } auto data (void) const { return begin (); }