mirror of
https://github.com/ETLCPP/etl.git
synced 2026-07-30 16:26:17 +08:00
Added etl::for_each_iterator
This commit is contained in:
parent
421244b7b9
commit
b9d008fa72
@ -2733,6 +2733,28 @@ namespace etl
|
||||
return begin;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
/// Like std::for_each but passes the iterator to the function.
|
||||
/// There is currently no STL equivalent.
|
||||
///\ingroup algorithm
|
||||
//***************************************************************************
|
||||
template <typename TIterator,
|
||||
typename TUnaryFunction,
|
||||
typename TUnaryPredicate>
|
||||
TUnaryFunction for_each_iterator(TIterator begin,
|
||||
const TIterator end,
|
||||
TUnaryFunction function)
|
||||
{
|
||||
while (begin != end)
|
||||
{
|
||||
function(begin);
|
||||
|
||||
++begin;
|
||||
}
|
||||
|
||||
return function;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
/// A safer form of std::transform where the transform returns when the first
|
||||
/// range end is reached.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user