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.
This commit is contained in:
Danny Robson 2017-08-01 14:47:44 +10:00
parent eabf93bc2a
commit 5634e59dc5

View File

@ -51,14 +51,14 @@ namespace util {
m_end (std::end (klass)) m_end (std::end (klass))
{ ; } { ; }
constexpr T& begin (void) noexcept { return m_begin; } constexpr T begin (void) noexcept { return m_begin; }
constexpr T& end (void) noexcept { return m_end; } constexpr T end (void) noexcept { return m_end; }
constexpr const T& begin (void) const noexcept { return cbegin (); } constexpr const T begin (void) const noexcept { return cbegin (); }
constexpr const T& end (void) const noexcept { return cend (); } constexpr const T end (void) const noexcept { return cend (); }
constexpr const T& cbegin (void) const noexcept { return m_begin; } constexpr const T cbegin (void) const noexcept { return m_begin; }
constexpr const T& cend (void) const noexcept { return m_end; } constexpr const T cend (void) const noexcept { return m_end; }
auto data (void) { return begin (); } auto data (void) { return begin (); }
auto data (void) const { return begin (); } auto data (void) const { return begin (); }