mirror of
https://github.com/cookiengineer/audacity
synced 2026-02-22 22:21:24 +01:00
Define and use utility template ValueIterator...
... generalizing the fix of commit 7591891 to other cases, making the iterators
safe for adaptation with std::reverse_iterator should the need ever arise
This commit is contained in:
@@ -430,6 +430,19 @@ template< typename T >
|
||||
ValueRestorer< T > valueRestorer( T& var, const T& newValue )
|
||||
{ return ValueRestorer< T >{ var, newValue }; }
|
||||
|
||||
/**
|
||||
\brief A convenience for defining iterators that return rvalue types, so that
|
||||
they cooperate correctly with stl algorithms and std::reverse_iterator
|
||||
*/
|
||||
template< typename Value, typename Category = std::forward_iterator_tag >
|
||||
using ValueIterator = std::iterator<
|
||||
Category, const Value, ptrdiff_t,
|
||||
// void pointer type so that operator -> is disabled
|
||||
void,
|
||||
// make "reference type" really the same as the value type
|
||||
const Value
|
||||
>;
|
||||
|
||||
/**
|
||||
\brief A convenience for use with range-for
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user