78 list =
reinterpret_cast<T*
>(0);
83 template<
class CloneArg>
87 const CloneArg& cloneArg
105 template<
class... Args>
153 <<
"Attempted push_back to self" 157 const label idx = this->size();
158 const label len = other.size();
162 for (label i = 0; i < len; ++i)
164 set(idx + i, other.release(i));
172 template<
class... Args>
179 return set(i,
new T(std::forward<Args>(
args)...));
198 std::unique_ptr<T>&& ptr
201 return set(i, ptr.release());
212 return set(i, ptr.release());
223 return set(i, ptr.
ptr());
234 return set(i, ptr.
ptr());
241 if (i < 0 || i >= this->size())
253 (this->ptrs_).free();
263 this->transfer(list);
patchWriters resize(patchIds.size())
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void set(List< bool > &bools, const labelUList &locations)
Set the listed locations (assign 'true').
void emplace_back(Args &&... args)
Construct and append an element to the end of the list.
T * ptr() const
Return managed pointer for reuse, or clone() the object reference.
A class for managing references or pointers (no reference counting)
autoPtr< T > emplace(const label i, Args &&... args)
Construct and set an element.
constexpr PtrList() noexcept
Default construct.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
errorManip< error > abort(error &err)
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void free()
Delete the allocated entries, but retain the list size.
void operator=(const PtrList< T > &list)
Copy assignment.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
autoPtr< T > release(const label i)
Release ownership of the pointer at the given position.
void push_back(T *ptr)
Append an element to the end of the list.
void clear()
Clear the PtrList. Delete allocated entries and set size to zero.
void transfer(PtrList< T > &list)
Transfer into this list and annul the argument list.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
T * ptr() const
Return managed pointer for reuse, or clone() the object reference.
A class for managing temporary objects.
Foam::argList args(argc, argv)