aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-01-11 11:08:06 +0100
committerSven Gothel <[email protected]>2021-01-11 11:08:06 +0100
commit9da96c6df4e029a749d71b3b02efe57bc6df498b (patch)
tree2e02c66dc63a9f69821a054505ca193dc191b531 /include
parent2ef4eba2528f13f775302e1a322a346511de9033 (diff)
basic_algos: Adjust to cow_iterator changes
Diffstat (limited to 'include')
-rw-r--r--include/jau/basic_algos.hpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/include/jau/basic_algos.hpp b/include/jau/basic_algos.hpp
index 5dba238..22338bf 100644
--- a/include/jau/basic_algos.hpp
+++ b/include/jau/basic_algos.hpp
@@ -295,11 +295,11 @@ namespace jau {
const typename T::value_type * find_const(T& data, typename T::value_type const & elem,
std::enable_if_t< is_cow_type<T>::value, bool> = true ) noexcept
{
- typename T::const_iterator begin = data.cbegin();
- typename T::const_iterator end = begin.end();
- auto it = jau::find( begin, end, elem);
- if( it != end ) {
- return &(*it);
+ typename T::const_iterator first = data.cbegin();
+ for (; !first.is_end(); ++first) {
+ if (*first == elem) {
+ return &(*first);
+ }
}
return nullptr;
}
@@ -307,10 +307,12 @@ namespace jau {
const typename T::value_type * find_const(T& data, typename T::value_type const & elem,
std::enable_if_t< !is_cow_type<T>::value, bool> = true ) noexcept
{
- typename T::const_iterator end = data.cend();
- auto it = jau::find( data.cbegin(), end, elem);
- if( it != end ) {
- return &(*it);
+ typename T::const_iterator first = data.cbegin();
+ typename T::const_iterator last = data.cend();
+ for (; first != last; ++first) {
+ if (*first == elem) {
+ return &(*first);
+ }
}
return nullptr;
}
@@ -323,8 +325,7 @@ namespace jau {
std::enable_if_t< is_cow_type<T>::value, bool> = true ) noexcept
{
typename T::const_iterator first = data.cbegin();
- typename T::const_iterator last = first.end();
- for (; first != last; ++first) {
+ for (; !first.is_end(); ++first) {
f(*first);
}
return f; // implicit move since C++11
@@ -352,8 +353,7 @@ namespace jau {
std::enable_if_t< is_cow_type<T>::value, bool> = true ) noexcept
{
typename T::const_iterator first = data.cbegin();
- typename T::const_iterator last = first.end();
- for (; first != last; ++first) {
+ for (; !first.is_end(); ++first) {
f( *const_cast<typename T::value_type*>( & (*first) ) );
}
return f; // implicit move since C++11