Stroika Library 3.0d24
 
Loading...
Searching...
No Matches
DelegatedIterator.h
Go to the documentation of this file.
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2026. All rights reserved
3 */
4#ifndef _Stroika_Foundation_Traversal_DelegatedIterator_h_
5#define _Stroika_Foundation_Traversal_DelegatedIterator_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include "Stroika/Foundation/Common/Common.h"
13
14/**
15 * \file
16 *
17 */
18
19namespace Stroika::Foundation::Traversal {
20
21 /**
22 * Handy helper to combine (or track) iterators
23 */
24 template <typename T, typename EXTRA_DATA = Common::Empty>
25 class DelegatedIterator : public Iterator<T> {
26 public:
27 struct Rep : Iterator<T>::IRep {
28 using IRep = typename Iterator<T>::IRep;
29 Iterator<T> fDelegateTo;
31 Rep (const Iterator<T>& delegateTo, const EXTRA_DATA& extraData = EXTRA_DATA{});
32 virtual unique_ptr<IRep> Clone () const override;
33 virtual bool AtEnd () const override;
34 virtual optional<T> Current () const override;
35 virtual optional<T> More () override;
36 virtual bool Equals (const IRep* rhs) const override;
37 };
38 DelegatedIterator (const Iterator<T>& delegateTo, const EXTRA_DATA& extraData = EXTRA_DATA{});
39 };
40
41}
42
43/*
44 ********************************************************************************
45 ******************************* Implementation Details *************************
46 ********************************************************************************
47 */
48#include "DelegatedIterator.inl"
49
50#endif /*_Stroika_Foundation_Traversal_DelegatedIterator_h_ */
#define qStroika_ATTRIBUTE_NO_UNIQUE_ADDRESS_VCFORCE
[[msvc::no_unique_address]] isn't always broken in MSVC. Annotate with this on things where its not b...
Definition StdCompat.h:443
Implementation detail for iterator implementors.
Definition Iterator.h:616
An Iterator<T> is a copyable object which allows traversing the contents of some container.
Definition Iterator.h:253