41#ifndef Foam_PtrDynList_H
42#define Foam_PtrDynList_H
55template<
class T,
int SizeMin>
class PtrDynList;
61template<
class T,
int SizeMin=64>
66 static_assert(SizeMin > 0,
"Invalid min size parameter");
111 const
T*
get(const label i)
const {
return this->
test(i); }
116 const T*
set(
const label i)
const {
return this->
test(i); }
122 inline void reserve(
const label len);
125 inline void resize(
const label newLen);
156 template<
int AnySizeMin>
160 template<class... Args>
173 inline
void append(std::unique_ptr<
T>&& ptr);
185 template<
int AnySizeMin>
192 template<class... Args>
205 inline
autoPtr<
T>
set(const label i, std::unique_ptr<
T>&& ptr);
226 template<
int AnySizeMin>
236 template<
int AnySizeMin>
247#include "PtrDynListI.H"
A dynamically resizable PtrList with allocation management.
const T * set(const label i) const
void shrink()
Shrink the allocated space to the number of elements used.
constexpr PtrDynList() noexcept
Default construct.
void append(T *ptr)
Append an element to the end of the list.
void setSize(const label n)
Same as resize()
void emplace_append(Args &&... args)
Construct and append an element to the end of the list.
autoPtr< T > remove()
Remove and return the top element.
void clearStorage()
Clear the list and delete storage.
label capacity() const noexcept
Size of the underlying storage.
const T * get(const label i) const
label expandStorage() noexcept
Expand the addressable size to fit the allocated capacity.
void reorder(const labelUList &oldToNew)
Reorder elements. Reordering must be unique (ie, shuffle).
void reserve(const label len)
Reserve allocation space for at least this size.
autoPtr< T > emplace(const label i, Args &&... args)
Construct and set an element.
void clear()
Clear the addressed list, i.e. set the size to zero.
void swap(PtrDynList< T, AnySizeMin > &other)
Swap content, independent of sizing parameter.
~PtrDynList()=default
Destructor.
void resize(const label newLen)
Alter the addressed list size.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
void free()
Delete the allocated entries, but retain the list size.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
const T * test(const label i) const
friend Ostream & operator(Ostream &os, const UPtrList< T > &list)
Write UPtrList to Ostream.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A class for managing references or pointers (no reference counting)
A class for managing temporary objects.
Foam::argList args(argc, argv)