https://git.reactos.org/?p=reactos.git;a=commitdiff;h=103d84448ffbaebc51a74…
commit 103d84448ffbaebc51a7451eb3f4f12f32f1538c
Author: Vitaly Orekhov <crce2000(a)mail.ru>
AuthorDate: Fri Sep 27 23:09:30 2024 +0300
Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org>
CommitDate: Mon Oct 7 15:41:28 2024 +0200
[ATL] Implement CAtlList::AddHeadList and CAtlList::AddTailList
What about a convenient way to append CAtlList to each other?
---
sdk/lib/atl/atlcoll.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/sdk/lib/atl/atlcoll.h b/sdk/lib/atl/atlcoll.h
index 1068deeacc5..8351a3a6f56 100644
--- a/sdk/lib/atl/atlcoll.h
+++ b/sdk/lib/atl/atlcoll.h
@@ -480,6 +480,9 @@ public:
POSITION AddHead(INARGTYPE element);
POSITION AddTail(INARGTYPE element);
+ void AddHeadList(_In_ const CAtlList<E, ETraits>* plNew);
+ void AddTailList(_In_ const CAtlList<E, ETraits>* plNew);
+
E RemoveHead();
E RemoveTail();
@@ -639,6 +642,24 @@ POSITION CAtlList<E, ETraits>::AddTail(INARGTYPE element)
return (POSITION)Node;
}
+template <typename E, class ETraits>
+void CAtlList<E, ETraits>::AddHeadList(_In_ const CAtlList<E, ETraits>*
plNew)
+{
+ ATLASSERT(plNew != NULL && plNew != this);
+ POSITION pos = plNew->GetTailPosition();
+ while (pos)
+ AddHead(plNew->GetPrev(pos));
+}
+
+template <typename E, class ETraits>
+void CAtlList<E, ETraits>::AddTailList(_In_ const CAtlList<E, ETraits>*
plNew)
+{
+ ATLASSERT(plNew != NULL && plNew != this);
+ POSITION pos = plNew->GetHeadPosition();
+ while (pos)
+ AddTail(plNew->GetNext(pos));
+}
+
template<typename E, class ETraits>
E CAtlList<E, ETraits>::RemoveHead()
{