46 #ifndef Foam_PtrList_H 47 #define Foam_PtrList_H 58 template<
class T>
class autoPtr;
59 template<
class T>
class refPtr;
60 template<
class T>
class tmp;
61 template<
class T>
class PtrList;
62 template<
class T> Istream&
operator>>(Istream& is, PtrList<T>& list);
90 inline explicit
PtrList(const label len);
99 inline explicit
PtrList(UList<
T*>& list);
102 template<class CloneArg>
113 PtrList(Istream& is, const INew& inew);
126 template<class... Args>
148 void resize(
const label newLen);
157 template<
class... Args>
164 inline void push_back(std::unique_ptr<T>&& ptr);
183 template<
class... Args>
187 template<
class... Args>
195 template<
class... Args>
203 inline autoPtr<T> set(
const label i, std::unique_ptr<T>&& ptr);
248 return this->
set(i, ptr.
release());
264 void append(std::unique_ptr<T>&& ptr)
LPtrList< SLListBase, T > SLPtrList
Forward declarations for SLPtrList.
PtrList< T > clone(Args &&... args) const
Make a copy by cloning each of the list elements.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
void setSize(const label n)
Same as resize()
void readIstream(Istream &is, const INew &inew)
Read from Istream using Istream constructor class.
A class for managing references or pointers (no reference counting)
T & emplace_back(Args &&... args)
Construct and append an element to the end of the list, return reference to the new list element...
void resize_null(const label newLen)
Set the addressed list to the given size, deleting all existing entries. Afterwards the list contains...
constexpr PtrList() noexcept
Default construct.
Istream & operator>>(Istream &, directionInfo &)
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
void free()
Free memory and nullify all entries. Does not change the list size.
void operator=(const PtrList< T > &list)
Copy assignment.
T * release() noexcept
Release ownership and return the pointer.
T & emplace(const label i, Args &&... args)
Same as emplace_set()
T & try_emplace(const label i, Args &&... args)
Like emplace_set() but will not overwrite an occupied (non-null) location.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
void resize(const label newLen)
Adjust size of PtrList.
void append(autoPtr< T > &ptr)
Move append an element to the end of the list.
T & emplace_set(const label i, Args &&... args)
Construct and set a new element at given position, (discard old element at that location).
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...
A class for managing temporary objects.
Foam::argList args(argc, argv)
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...