176 using StatsType = SkipList_Support::StatsType<KEY_TYPE, TRAITS>;
193 using TraitsType = TRAITS;
212 class ForwardIterator;
224 nonvirtual
bool Add (ArgByValueType<key_type> key, ForwardIterator* oAddedI =
nullptr)
225 requires (same_as<mapped_type, void>)
226#
if qCompilerAndStdLib_RequiresNotMatchInlineOutOfLineForTemplateClassBeingDefined_Buggy
228 return Add1_ (key, oAddedI);
233 template <
typename CHECK_T = MAPPED_TYPE>
234 nonvirtual
bool Add (ArgByValueType<key_type> key, ArgByValueType<CHECK_T> val, ForwardIterator* oAddedI =
nullptr)
235 requires (not same_as<mapped_type, void>)
236#
if qCompilerAndStdLib_RequiresNotMatchInlineOutOfLineForTemplateClassBeingDefined_Buggy
238 return Add2_ (key, val, oAddedI);
243 nonvirtual
bool Add (
const value_type& v, ForwardIterator* oAddedI =
nullptr);
259 nonvirtual
void Remove (ArgByValueType<key_type> key);
260 nonvirtual
void Remove (
const ForwardIterator& it);
276 nonvirtual ForwardIterator
erase (
const ForwardIterator& i);
286 nonvirtual
bool RemoveIf (ArgByValueType<key_type> key);
292 nonvirtual
void clear ();
299 nonvirtual
size_t size ()
const;
306 nonvirtual
bool empty ()
const;
311 nonvirtual ForwardIterator begin ()
const;
316 constexpr ForwardIterator end () const noexcept;
351 nonvirtual ForwardIterator
Find (ArgByValueType<
key_type> key) const;
352 template <typename ARG_T = typename TRAITS::AlternateFindType>
353 nonvirtual ForwardIterator
Find (ARG_T key) const
354 requires (not same_as<typename TRAITS::AlternateFindType,
void> and same_as<remove_cvref_t<ARG_T>, typename TRAITS::AlternateFindType>);
355 template <predicate<typename SkipList<KEY_TYPE, MAPPED_TYPE, TRAITS>::
value_type> FUNCTION>
356 nonvirtual ForwardIterator
Find (FUNCTION&& firstThat) const
357#if qCompilerAndStdLib_RequiresNotMatchInlineOutOfLineForTemplateClassBeingDefined_Buggy
359 for (
auto i = begin (); i; ++i) {
360 if (firstThat (*i)) {
400 nonvirtual optional<mapped_type>
First (ArgByValueType<key_type> key)
const;
401 template <qCompilerAndStdLib_RequiresNotMatchXXXDefined_1_BWA (predicate<
typename SkipList<KEY_TYPE, MAPPED_TYPE, TRAITS>::value_type>) FUNCTION>
402 nonvirtual optional<mapped_type>
First (FUNCTION&& firstThat)
const;
408 template <
typename CHECKED_T = MAPPED_TYPE>
409 nonvirtual
void Update (
const ForwardIterator& it, ArgByValueType<CHECKED_T> newValue)
410 requires (not same_as<MAPPED_TYPE, void>);
434 nonvirtual
void Prioritize (ArgByValueType<key_type> key);
441 template <qCompilerAndStdLib_RequiresNotMatchXXXDefined_1_BWA (invocable<
typename SkipList<KEY_TYPE, MAPPED_TYPE, TRAITS>::value_type>) FUNCTION>
442 nonvirtual
void Apply (FUNCTION&& doToElement)
const;
447 constexpr void Invariant () const noexcept;
455 nonvirtual
size_t CalcHeight (
size_t* totalHeight =
nullptr) const;
474 nonvirtual Link_* GetFirst_ () const;
477 nonvirtual Link_* GetLast_ () const;
482 static constexpr
size_t kMaxLinkHeight_ = sizeof (
size_t) * 8;
486 using LinkVector_ = vector<Link_*>;
490 struct Link_ : public Memory::UseBlockAllocationIfAppropriate<Link_, sizeof (
value_type) <= 128> {
491 template <
typename MAPPED_TYPE2 = MAPPED_TYPE>
492 constexpr Link_ (ArgByValueType<key_type> key, ArgByValueType<MAPPED_TYPE2> val)
493 requires (not same_as<MAPPED_TYPE2, void>)
494#
if qCompilerAndStdLib_RequiresNotMatchInlineOutOfLineForTemplateClassBeingDefined_Buggy
495 : fEntry{key, val} {}
499 constexpr Link_ (ArgByValueType<key_type> key)
500 requires (same_as<MAPPED_TYPE, void>)
501#
if qCompilerAndStdLib_RequiresNotMatchInlineOutOfLineForTemplateClassBeingDefined_Buggy
506 constexpr Link_ (ArgByValueType<value_type> v);
511 LinkVector_ fHead_{};
517 template <Common::IAnyOf<KEY_TYPE,
typename TRAITS::AlternateFindType> KEYISH_T>
518 nonvirtual Link_* FindLink_ (
const KEYISH_T& key)
const;
530 @todo CONSIDER if LinkVector sb replaced with set<Link*>
532 struct LinkAndInfoAboutBackPointers {
538 LinkVector_ fLinksPointingToReturnedLink;
540 nonvirtual LinkAndInfoAboutBackPointers FindNearest_ (
const variant<key_type, ForwardIterator>& keyOrI)
const;
545 nonvirtual
void AddLink_ (Link_* n,
const LinkVector_& linksToPatch);
549 nonvirtual
void RemoveLink_ (Link_* n,
const LinkVector_& linksToPatch);
551#if qStroika_Foundation_Debug_AssertionsChecked
553 nonvirtual
void Invariant_ () const noexcept;
557 nonvirtual
void ShrinkHeadLinksIfNeeded_ ();
560 nonvirtual
void GrowHeadLinksIfNeeded_ (
size_t newSize, Link_* linkToPointTo);
563 nonvirtual
size_t DetermineLinkHeight_ ()
const;
565#if qCompilerAndStdLib_RequiresNotMatchInlineOutOfLineForTemplateClassBeingDefined_Buggy
567 bool Add1_ (ArgByValueType<key_type> key, ForwardIterator* oAddedI);
568 template <
typename CHECK_T = MAPPED_TYPE>
569 bool Add2_ (ArgByValueType<key_type> key, ArgByValueType<CHECK_T> val, ForwardIterator* oAddedI);
575 [[no_unique_address]]
mutable StatsType fStats_{};