9namespace Stroika::Foundation::Traversal {
17 function<optional<T> ()> fFun_;
19 GenItWrapper_ () =
delete;
20 GenItWrapper_ (
const function<optional<T> ()>& f)
25 virtual void More (optional<T>* result,
bool advance)
override
30 if (fCur_.has_value ()) {
39 const GenItWrapper_& rrhs = *Debug::UncheckedDynamicCast<const GenItWrapper_*> (rhs);
41 WeakAssert (not fCur_.has_value () or not rrhs.fCur_.has_value ());
42 return fCur_.has_value () == rrhs.fCur_.has_value ();
44 virtual unique_ptr<typename Iterator<T>::IRep> Clone ()
const override
46 return make_unique<GenItWrapper_> (*
this);
49 return Iterator<T>{make_unique<GenItWrapper_> (getNext)};
#define RequireNotNull(p)
#define WeakAssert(c)
A WeakAssert() is for things that aren't guaranteed to be true, but are overwhelmingly likely to be t...
conditional_t< qStroika_Foundation_Memory_PreferBlockAllocation and andTrueCheck, BlockAllocationUseHelper< T >, Common::Empty > UseBlockAllocationIfAppropriate
Use this to enable block allocation for a particular class. Beware of subclassing.
Iterator< T > CreateGeneratorIterator(const function< optional< T >()> &getNext)
Iterable< T > CreateGenerator(const function< optional< T >()> &getNext)
Create an Iterable<T> from a function that returns optional<T> - treating nullopt as meaning the END ...
Iterable< T > MakeIterableFromIterator(const Iterator< T > &iterator)
Iterable<T> is a base class for containers which easily produce an Iterator<T> to traverse them.
Implementation detail for iterator implementors.
An Iterator<T> is a copyable object which allows traversing the contents of some container....