view: find function takes const ref

This commit is contained in:
Danny Robson 2016-11-14 21:29:43 +11:00
parent 86332b4d3c
commit b027b60be0
2 changed files with 2 additions and 2 deletions

View File

@ -44,7 +44,7 @@ namespace util {
constexpr const T& cbegin (void) const noexcept; constexpr const T& cbegin (void) const noexcept;
constexpr const T& cend (void) const noexcept; constexpr const T& cend (void) const noexcept;
constexpr T find (value_type) const noexcept; constexpr T find (const value_type&) const noexcept;
constexpr bool empty (void) const noexcept; constexpr bool empty (void) const noexcept;
constexpr size_t size (void) const noexcept; constexpr size_t size (void) const noexcept;

View File

@ -111,7 +111,7 @@ util::view<T>::cend (void) const noexcept
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
template <typename T> template <typename T>
constexpr T constexpr T
util::view<T>::find (value_type v) const noexcept util::view<T>::find (const value_type &v) const noexcept
{ {
for (T i = cbegin (); i != cend (); ++i) for (T i = cbegin (); i != cend (); ++i)
if (*i == v) if (*i == v)