31#ifndef LIB_ITER_ADAPTER_STL_H
32#define LIB_ITER_ADAPTER_STL_H
96 template<
typename DEF>
126 template<
typename IT>
141 template<
typename IT>
156 template<
typename IT>
167 template<
typename IT>
188 using Key = MAP::value_type::first_type;
189 using Val = MAP::value_type::second_type;
190 using Itr = MAP::iterator;
196 using Key = MAP::value_type::first_type;
197 using Val = MAP::value_type::second_type
const;
198 using Itr = MAP::const_iterator;
202 template<
class IT,
typename SEL>
210 template<
class IT,
typename SEL>
242 using KeyType = EntryIter::value_type::first_type;
243 using ValType = EntryIter::value_type::second_type;
269 using Iter = SEQ::const_iterator;
284 inline _SeqT<CON>::Range
287 using Range = _SeqT<CON>::Range;
288 return Range (coll.begin(), coll.end());
296 inline _SeqT<CON>::Addrs
299 using Addresses = _SeqT<CON>::Addrs;
300 return Addresses (
eachElm (coll));
308 inline _MapT<MAP>::KeyIter
311 using Range = _MapT<MAP>::KeyIter;
312 using PickKey = _MapT<MAP>::PickKeyIter;
314 return Range (PickKey (map.begin()), PickKey (map.end()));
322 inline _MapIterT<IT>::KeyIter
325 using Range = _MapIterT<IT>::KeyIter;
326 using PickKey = _MapIterT<IT>::PickKeyIter;
328 return Range (PickKey (begin), PickKey (end));
336 inline _MapT<MAP>::ValIter
339 using Range = _MapT<MAP>::ValIter;
340 using PickVal = _MapT<MAP>::PickValIter;
342 return Range (PickVal (map.begin()), PickVal (map.end()));
350 inline _MapIterT<IT>::ValIter
353 using Range = _MapIterT<IT>::ValIter;
354 using PickVal = _MapIterT<IT>::PickValIter;
356 return Range (PickVal (begin), PickVal (end));
364 inline _SeqT<SEQ>::DistinctVals
367 using Range = _SeqT<SEQ>::Range;
368 using DistinctValues = _SeqT<SEQ>::DistinctVals;
370 return DistinctValues (Range (seq.begin(), seq.end()));
379 inline _MapT<MAP>::DistinctKeys
382 return typename _MapT<MAP>::DistinctKeys (
eachKey (map));
390 template<
class MMAP,
typename KEY>
391 inline _MapT<MMAP>::ValIter
394 using Pos = _MapT<MMAP>::EntryIter;
395 using Range = _MapT<MMAP>::ValIter;
396 using PickVal = _MapT<MMAP>::PickValIter;
398 std::pair<Pos,Pos> valRange = multimap.equal_range (key);
400 return Range (PickVal{valRange.first}, PickVal{valRange.second});
413 template<
typename VAL>
445 for (IT copy{src}; copy; ++copy)
453 for ( ; pos!=end; ++pos)
461 for (IT pos{begin}; pos!=end; ++pos)
471 operator bool()
const
542 return not (snap1 == snap2);
551 _throwIterExhausted();
568 inline ContentSnapshot<CON>
571 return ContentSnapshot<CON>{begin(con), end(con)};
578 inline ContentSnapshot<IT>
581 return ContentSnapshot<IT>{ii};
598 return OnceIter(begin(ili), end(ili));
wrapper for an existing Iterator type to expose the address of each value yielded.
Accessing a STL element range through a Lumiera forward iterator, An instance of this iterator adapte...
Helper to filter repeated values from a wrapped iterator (both STL or Lumiera)
DistinctIter & operator++()
friend bool operator!=(DistinctIter const &i1, DistinctIter const &i2)
IT::value_type value_type
reference operator*() const
friend bool operator==(DistinctIter const &i1, DistinctIter const &i2)
DistinctIter(IT const &i)
pointer operator->() const
materialised iterator contents.
IterSnapshot()
create empty snapshot
IterSnapshot(IT &&pos, IT const &end)
take snapshot by consuming a STL iterator
IterSnapshot(IterSnapshot &&)=default
IterSnapshot(IT const &begin, IT const &end)
take snapshot from STL iterator
void _maybe_throw() const
IterSnapshot(IT const &src)
build snapshot from a copy of the Lumiera Iterator
IterSnapshot & operator=(IterSnapshot const &)=default
IterSnapshot(IT &&src)
take snapshot by discharging the given Lumiera Forward iterator
friend bool operator!=(IterSnapshot const &snap1, IterSnapshot const &snap2)
IterSnapshot(IterSnapshot const &)=default
friend bool operator==(IterSnapshot const &s1, IterSnapshot const &s2)
equality is based first on the valid state (to support pos != end) and then on the actual position an...
reference operator*() const
std::vector< VAL > Sequence
pointer operator->() const
IterSnapshot & operator++()
Extension adapter for Lumiera Forward Iterators to dereference any pointer values automatically.
Helper template(s) for creating Lumiera Forward Iterators.
#define ENABLE_USE_IN_STD_RANGE_FOR_LOOPS(ITER)
use a given Lumiera Forward Iterator in standard "range for loops"
MAP::value_type::first_type Key
DistinctIter< Range > DistinctVals
WrappedStlIter< Wrapped_PickConstVal< IT > > PickVal
EntryIter::value_type::second_type ValType
EntryIter::reference DetectConst
RangeIter< PickKeyIter > KeyIter
RangeIter< PickValIter > ValIter
_MapTypeSelector< MAP >::Val ValType
MAP::value_type::second_type Val
EntryIter::value_type::first_type KeyType
IterSnapshot< typename CON::value_type > ContentSnapshot
_MapTypeSelector< MAP >::Itr EntryIter
_MapTypeSelector< MAP >::Key KeyType
_MapSubSelector< EntryIter, DetectConst >::PickKey PickKeyIter
DistinctIter< KeyIter > DistinctKeys
WrappedStlIter< Wrapped_PickKey< IT > > PickKey
WrappedStlIter< Wrapped_PickVal< IT > > PickVal
_MapSubSelector< EntryIter, DetectConst >::PickVal PickValIter
AddressExposingIter< Range > Addrs
MAP::value_type::second_type const Val
helper to access the parts of the pair values correctly...
_MapT< MAP >::DistinctKeys eachDistinctKey(MAP &map)
ContentSnapshot< CON > snapshot(CON const &con)
Take a snapshot of the given STL compliant container.
_SeqT< CON >::Range eachElm(CON &coll)
ContentSnapshot< IT > dischargeToSnapshot(IT &ii)
Take a snapshot of the given LumieraIterator, which is thereby consumed.
_MapT< MAP >::KeyIter eachKey(MAP &map)
_MapT< MMAP >::ValIter eachValForKey(MMAP &multimap, KEY key)
_SeqT< SEQ >::DistinctVals eachDistinct(SEQ &seq)
build a Lumiera Forward Iterator to suppress any repetitions in the given sequence.
_MapT< MAP >::ValIter eachVal(MAP &map)
_SeqT< CON >::Addrs eachAddress(CON &coll)
Implementation namespace for support and library code.
helper baseclass to simplify defining customised wrapped STL iterators
friend bool operator!=(WrappedStlIter const &i1, WrappedStlIter const &i2)
friend bool operator==(WrappedStlIter const &i1, WrappedStlIter const &i2)
reference operator*() const
WrappedStlIter & operator++()
WrappedStlIter(Iter const &i)
pointer operator->() const
Wrapped-Iter-Policy: forwarding directly with typing retained unaltered.
IT::value_type value_type
static Iter get(Iter &it)
static pointer get(Iter &it)
const value_type * pointer
const value_type & reference
const IT::value_type::second_type value_type
Wrapped-Iter-Policy: picking the key part of a pair iterator (map or multimap).
static pointer get(Iter &it)
IT::value_type::first_type value_type
Wrapped-Iter-Policy: picking the value part of a pair iterator (map or multimap).
static pointer get(Iter &it)
IT::value_type::second_type value_type