16 class Collection_stdforward_list<T>::Rep_ :
public Collection<T>::_IRep,
public Memory::UseBlockAllocationIfAppropriate<Rep_> {
18 using inherited =
typename Collection<T>::_IRep;
22 Rep_ (
const Rep_&
from) =
default;
25 nonvirtual Rep_& operator= (
const Rep_&) =
delete;
32 return Memory::MakeSharedPtr<Rep_> (*
this);
39 virtual size_t size ()
const override
43 for (
auto i = fData_.begin (); i != fData_.end (); ++i, ++
cnt)
47 virtual bool empty ()
const override
50 return fData_.empty ();
68 return Memory::MakeSharedPtr<Rep_> ();
74 auto result = Memory::MakeSharedPtr<Rep_> (*
this);
75 auto&
mir = Debug::UncheckedDynamicCast<const IteratorRep_&> (i->ConstGetRep ());
76 result->fData_.MoveIteratorHereAfterClone (
77 &
mir.fIterator, &fData_,
85 fData_.push_front (
item);
86 fChangeCounts_.PerformedChange ();
94 Require (
not i.Done ());
96 if (
nextI !=
nullptr) {
97 savedUnderlyingIndex = Debug::UncheckedDynamicCast<const IteratorRep_&> (i.ConstGetRep ()).fIterator.GetUnderlyingIteratorRep ();
99 *fData_.remove_constness (Debug::UncheckedDynamicCast<const IteratorRep_&> (i.ConstGetRep ()).fIterator.GetUnderlyingIteratorRep ()) =
newValue;
100 fChangeCounts_.PerformedChange ();
101 if (
nextI !=
nullptr) {
110 typename STDFORWARDLIST::const_iterator
victim =
111 Debug::UncheckedDynamicCast<const IteratorRep_&> (i.ConstGetRep ()).fIterator.GetUnderlyingIteratorRep ();
112 typename STDFORWARDLIST::const_iterator
prevI;
115 Assert (
prevI != fData_.end ());
117 fChangeCounts_.PerformedChange ();
118 if (
nextI !=
nullptr) {
124 using DataStructureImplType_ = DataStructures::STLContainerWrapper<STDFORWARDLIST>;
125 using IteratorRep_ = Private::IteratorImplHelper_<value_type, DataStructureImplType_>;
128 DataStructureImplType_ fData_;
137 template <
typename T>
139 :
inherited{Memory::MakeSharedPtr<Rep_> ()}
141 AssertRepValidType_ ();
143 template <
typename T>
144 template <IInputIterator<T> ITERATOR_OF_ADDABLE>
149 AssertRepValidType_ ();
151 template <
typename T>
153 : Collection_stdforward_list{}
156 AssertRepValidType_ ();
158#if !qCompilerAndStdLib_RequiresNotMatchInlineOutOfLineForTemplateClassBeingDefined_Buggy
159 template <
typename T>
160 template <IIterableOfTo<T> ITERABLE_OF_ADDABLE>
161 requires (not derived_from<remove_cvref_t<ITERABLE_OF_ADDABLE>, Collection_stdforward_list<T>>)
163 : Collection_stdforward_list{}
165 this->AddAll (forward<ITERABLE_OF_ADDABLE> (src));
166 AssertRepValidType_ ();
169 template <
typename T>
170 inline void Collection_stdforward_list<T>::AssertRepValidType_ ()
const
173 typename inherited::template _SafeReadRepAccessor<Rep_> tmp{
this};
#define qStroika_Foundation_Debug_AssertionsChecked
The qStroika_Foundation_Debug_AssertionsChecked flag determines if assertions are checked and validat...
#define RequireNotNull(p)
#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...
A Collection<T> is a container to manage an un-ordered collection of items, without equality defined ...
nonvirtual void AddAll(ITERATOR_OF_ADDABLE &&start, ITERATOR_OF_ADDABLE2 &&end)
nonvirtual void Update(const Iterator< value_type > &i, ArgByValueType< value_type > newValue, Iterator< value_type > *nextI=nullptr)
nonvirtual void Remove(ArgByValueType< value_type > item, EQUALS_COMPARER &&equalsComparer={})
Remove () the argument value (which must exist)
nonvirtual void Add(ArgByValueType< value_type > item)
Collection_stdforward_list<T> is an std::forward_list (singly linked list)-based concrete implementat...
Collection_stdforward_list()
shared_lock< const AssertExternallySynchronizedMutex > ReadContext
Instantiate AssertExternallySynchronizedMutex::ReadContext to designate an area of code where protect...
unique_lock< AssertExternallySynchronizedMutex > WriteContext
Instantiate AssertExternallySynchronizedMutex::WriteContext to designate an area of code where protec...
nonvirtual void Apply(const function< void(ArgByValueType< T > item)> &doToElement, Execution::SequencePolicy seq=Execution::SequencePolicy::eDEFAULT) const
Run the argument function (or lambda) on each element of the container.
nonvirtual Iterator< T > Find(THAT_FUNCTION &&that, Execution::SequencePolicy seq=Execution::SequencePolicy::eDEFAULT) const
Run the argument bool-returning function (or lambda) on each element of the container,...
nonvirtual CONTAINER_OF_T As(CONTAINER_OF_T_CONSTRUCTOR_ARGS... args) const
nonvirtual size_t size() const
Returns the number of items contained.
nonvirtual bool empty() const
Returns true iff size() == 0.
static constexpr default_sentinel_t end() noexcept
Support for ranged for, and STL syntax in general.
nonvirtual Iterator< T > MakeIterator() const
Create an iterator object which can be used to traverse the 'Iterable'.
SequencePolicy
equivalent which of 4 types being used std::execution::sequenced_policy, parallel_policy,...