From e6f3c6c62111b37cc97db2d61a1c765695ee401a Mon Sep 17 00:00:00 2001 From: guyingzhao Date: Sun, 6 Apr 2025 12:18:23 +0200 Subject: C++: Array: Add const Node& variants to Append, Insert --- include/plist/Array.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'include/plist') diff --git a/include/plist/Array.h b/include/plist/Array.h index 34ddd6f..949fa4c 100644 --- a/include/plist/Array.h +++ b/include/plist/Array.h @@ -52,19 +52,18 @@ public : const_iterator End() const; const_iterator end() const; size_t size() const; - void Append(Node* node); - void Insert(Node* node, unsigned int pos); + void Append(const Node& node); + void Append(const Node* node); + void Insert(const Node& node, unsigned int pos); + void Insert(const Node* node, unsigned int pos); void Remove(Node* node); void Remove(unsigned int pos); - unsigned int GetNodeIndex(Node* node) const; - template - T* at(unsigned int index) - { + unsigned int GetNodeIndex(const Node& node) const; + unsigned int GetNodeIndex(const Node* node) const; + template T* at(unsigned int index) { return (T*)(_array.at(index)); } - template - T* At(unsigned int index) - { + template T* At(unsigned int index) { return (T*)(_array.at(index)); } -- cgit v1.1-32-gdbae