9 #ifndef GDCORE_SPTRLIST
10 #define GDCORE_SPTRLIST
33 T&
Insert(
const T& element,
size_t position = (
size_t)-1);
42 void Insert(std::shared_ptr<T> element,
size_t position = (
size_t)-1);
50 size_t position = (
size_t)-1);
55 size_t GetCount()
const {
return elements.size(); };
61 std::shared_ptr<T>
GetSmartPtr(
size_t index) {
return elements[index]; };
67 T&
Get(
size_t index) {
return *elements[index]; };
73 const T&
Get(
size_t index)
const {
return *elements[index]; };
78 void Remove(
const T& element);
88 bool IsEmpty()
const {
return elements.empty(); };
93 void Clear() {
return elements.clear(); };
103 bool Contains(
const T& elementToSearch)
const;
140 T&
at(
size_t index) {
return Get(index); };
146 const T&
at(
size_t index)
const {
return Get(index); };
150 std::vector<std::shared_ptr<T> > elements;
161 #include "SPtrList.inl"
Definition: SPtrList.h:18
T & at(size_t index)
Alias for Get()
Definition: SPtrList.h:140
const T & operator[](size_t index) const
Alias for Get()
Definition: SPtrList.h:134
void Init(const SPtrList< T > &other)
Definition: SPtrList.inl:90
const T & at(size_t index) const
Alias for Get()
Definition: SPtrList.h:146
T & Insert(const T &element, size_t position=(size_t) -1)
Insert the specified element to the list.
Definition: SPtrList.inl:35
const T & Get(size_t index) const
Return a reference to the element at position index in the elements list.
Definition: SPtrList.h:73
T & operator[](size_t index)
Alias for Get()
Definition: SPtrList.h:128
size_t size() const
Alias for GetCount()
Definition: SPtrList.h:116
void Remove(const T &element)
Remove the specified element.
Definition: SPtrList.inl:59
bool empty() const
Alias for IsEmpty()
Definition: SPtrList.h:122
void Clear()
Clear the list of elements.
Definition: SPtrList.h:93
T & Get(size_t index)
Return a reference to the element at position index in the elements list.
Definition: SPtrList.h:67
size_t GetCount() const
Return the number of elements.
Definition: SPtrList.h:55
bool IsEmpty() const
Return true if there isn't any element in the list.
Definition: SPtrList.h:88
bool Contains(const T &elementToSearch) const
Definition: SPtrList.inl:69
std::shared_ptr< T > GetSmartPtr(size_t index)
Return the smart pointer to the element at position index in the elements list.
Definition: SPtrList.h:61
Definition: CommonTools.h:24