Go to the documentation of this file.
33 template<
class T,
int SizeMin>
36 (this->ptrs_).setAddressableSize(len);
42 template<
class T,
int SizeMin>
50 template<
class T,
int SizeMin>
56 setAddressableSize(0);
60 template<
class T,
int SizeMin>
71 template<
class T,
int SizeMin>
78 capacity_(list.capacity_)
84 template<
class T,
int SizeMin>
94 template<
class T,
int SizeMin>
101 template<
class T,
int SizeMin>
107 if (nextFree > capacity_)
110 nextFree = capacity_;
114 setAddressableSize(nextFree);
118 template<
class T,
int SizeMin>
121 if (nElem > capacity_)
125 capacity_ =
max(SizeMin,
max(nElem, label(2*capacity_)));
130 setAddressableSize(nextFree);
135 template<
class T,
int SizeMin>
138 auto& ptrs = this->ptrs_;
140 const label oldLen = ptrs.size();
142 if (newLen > capacity_)
145 capacity_ =
max(SizeMin,
max(newLen, label(2*capacity_)));
149 else if (newLen != oldLen)
152 for (label i=newLen; i<oldLen; ++i)
165 setAddressableSize(newLen);
169 template<
class T,
int SizeMin>
176 template<
class T,
int SizeMin>
179 (this->ptrs_).free();
180 setAddressableSize(0);
184 template<
class T,
int SizeMin>
192 template<
class T,
int SizeMin>
198 setAddressableSize(capacity_);
204 template<
class T,
int SizeMin>
208 if (capacity_ > nextFree)
211 setAddressableSize(capacity_);
214 capacity_ = nextFree;
216 setAddressableSize(nextFree);
221 template<
class T,
int SizeMin>
230 template<
class T,
int SizeMin>
233 const label idx = this->size();
235 this->ptrs_[idx] = ptr;
239 template<
class T,
int SizeMin>
246 template<
class T,
int SizeMin>
253 template<
class T,
int SizeMin>
256 const label idx = this->size();
257 const label len = other.size();
261 for (label i=0; i < len; ++i)
263 set(idx + i, other.release(i));
270 template<
class T,
int SizeMin>
271 template<
int AnySizeMin>
277 const label idx = this->size();
278 const label len = other.size();
282 for (label i=0; i < len; ++i)
284 set(idx + i, other.release(i));
287 other.clearStorage();
291 template<
class T,
int SizeMin>
295 const label idx = (this->size() - 1);
303 this->ptrs_[idx] =
nullptr;
304 setAddressableSize(idx);
310 template<
class T,
int SizeMin>
317 template<
class T,
int SizeMin>
324 if (i >= this->size())
333 template<
class T,
int SizeMin>
340 return this->set(i,
const_cast<autoPtr<T>&
>(aptr).release());
344 template<
class T,
int SizeMin>
351 return this->set(i, tptr.
ptr());
355 template<
class T,
int SizeMin>
366 template<
class T,
int SizeMin>
382 template<
class T,
int SizeMin>
398 template<
class T,
int SizeMin>
399 template<
int AnySizeMin>
415 template<
class T,
int SizeMin>
432 template<
class T,
int SizeMin>
449 template<
class T,
int SizeMin>
450 template<
int AnySizeMin>
void reserve(const label nElem)
Reserve allocation space for at least this size.
void setSize(const label newLen)
Same as resize()
label expandStorage()
Expand the addressable size to fit the allocated capacity.
A class for managing temporary objects.
label capacity() const noexcept
Size of the underlying storage.
void reorder(const labelUList &oldToNew)
Reorder elements. Reordering must be unique (ie, shuffle).
void append(T *ptr)
Append an element to the end of the list.
A dynamically resizable PtrList with allocation management.
void resize(const label newLen)
Alter the addressed list size.
void shrink()
Shrink the allocated space to the number of elements used.
autoPtr< T > remove()
Remove and return the top element.
void setCapacity(const label nElem)
Alter the size of the underlying storage.
patchWriters resize(patchIds.size())
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
ListType reorder(const labelUList &oldToNew, const ListType &input, const bool prune=false)
Reorder the elements of a list.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const T * set(const label i) const
Return const pointer to element (if set) or nullptr.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
void clearStorage()
Clear the list and delete storage.
void clear()
Clear the addressed list, i.e. set the size to zero.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
constexpr PtrDynList() noexcept
Construct null.