aboutsummaryrefslogtreecommitdiffstats
path: root/include/jau/basic_algos.hpp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-01-18 11:17:22 +0100
committerSven Gothel <[email protected]>2021-01-18 11:17:22 +0100
commit15f05e588766d1912a3e28a7f164a0bac00c0bd8 (patch)
tree289b305a216db42d8a18ba7c285dea2d2fa637f0 /include/jau/basic_algos.hpp
parentd561f30be7e1083d4db700ed8d99719a12b3a7ee (diff)
basic_algos: Instantiate first iterator within for setup part
Diffstat (limited to 'include/jau/basic_algos.hpp')
-rw-r--r--include/jau/basic_algos.hpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/include/jau/basic_algos.hpp b/include/jau/basic_algos.hpp
index 22338bf..a252ade 100644
--- a/include/jau/basic_algos.hpp
+++ b/include/jau/basic_algos.hpp
@@ -295,8 +295,7 @@ 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 first = data.cbegin();
- for (; !first.is_end(); ++first) {
+ for (typename T::const_iterator first = data.cbegin(); !first.is_end(); ++first) {
if (*first == elem) {
return &(*first);
}
@@ -324,8 +323,7 @@ namespace jau {
constexpr UnaryFunction for_each_const(T& data, UnaryFunction f,
std::enable_if_t< is_cow_type<T>::value, bool> = true ) noexcept
{
- typename T::const_iterator first = data.cbegin();
- for (; !first.is_end(); ++first) {
+ for (typename T::const_iterator first = data.cbegin(); !first.is_end(); ++first) {
f(*first);
}
return f; // implicit move since C++11
@@ -352,8 +350,7 @@ namespace jau {
constexpr UnaryFunction for_each_fidelity(T& data, UnaryFunction f,
std::enable_if_t< is_cow_type<T>::value, bool> = true ) noexcept
{
- typename T::const_iterator first = data.cbegin();
- for (; !first.is_end(); ++first) {
+ for (typename T::const_iterator first = data.cbegin(); !first.is_end(); ++first) {
f( *const_cast<typename T::value_type*>( & (*first) ) );
}
return f; // implicit move since C++11