42 const label len = this->size();
44 for (label i=0; i<len; ++i)
46 this->ptrs_[i] = (list[i]).clone().ptr();
55 UPtrList<
T>(list.size())
60 for (
auto iter = list.cbegin(); iter != list.cend(); ++iter)
62 this->ptrs_[i++] = (*iter).clone().ptr();
80 template<
class... Args>
83 const label len = this->size();
87 for (label i=0; i<len; ++i)
89 const T* ptr = this->ptrs_[i];
93 cloned.
ptrs_[i] = ptr->clone(std::forward<Args>(
args)...).ptr();
104 const label oldLen = this->size();
110 else if (newLen != oldLen)
113 for (label i=newLen; i<oldLen; ++i)
115 T* ptr = this->ptrs_[i];
124 (this->ptrs_).
resize(newLen);
139 const label oldLen = this->size();
140 const label newLen = list.size();
148 for (label i=0; i<newLen; ++i)
150 (*this)[i] = list[i];
156 for (label i=0; i<oldLen; ++i)
158 (*this)[i] = list[i];
162 for (label i=oldLen; i<newLen; ++i)
164 this->ptrs_[i] = (list[i]).clone().ptr();
patchWriters resize(patchIds.size())
PtrList< T > clone(Args &&... args) const
Make a copy by cloning each of the list elements.
~PtrList()
Destructor. Frees all pointers.
constexpr PtrList() noexcept
Default construct.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
void operator=(const PtrList< T > &list)
Copy assignment.
Non-intrusive singly-linked pointer list.
void resize(const label newLen)
Adjust size of PtrList.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Foam::argList args(argc, argv)
Detail::PtrListDetail< T > ptrs_
The list of pointers.