41#ifndef Foam_PtrDynList_H
42#define Foam_PtrDynList_H
53template<
class T,
int SizeMin>
class PtrDynList;
59template<
class T,
int SizeMin=64>
64 static_assert(SizeMin > 0,
"Invalid min size parameter");
83 inline explicit PtrDynList(std::pair<label,label> sizing);
92 template<
int AnySizeMin>
111 label
capacity()
const noexcept {
return capacity_; }
119 inline void reserve(
const label len);
129 inline void resize(
const label len);
161 template<
int AnySizeMin>
168 template<
int AnySizeMin>
173 template<
class... Args>
180 inline void push_back(std::unique_ptr<T>&& ptr);
195 template<
int AnySizeMin>
207 template<
class... Args>
211 template<
class... Args>
218 template<
class... Args>
227 inline autoPtr<T> set(
const label i, std::unique_ptr<T>&& ptr);
258 template<
int AnySizeMin>
268 template<
int AnySizeMin>
296 void append(std::unique_ptr<T>&& ptr)
318 template<
int AnySizeMin>
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A dynamically resizable PtrList with allocation management.
T & emplace(const label i, Args &&... args)
Same as emplace_set().
void transfer(PtrList< T > &list)
Transfer contents of the argument PtrList into this.
void append(PtrList< T > &&other)
Move append another list to the end of this list.
void shrink()
Alias for shrink_to_fit().
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 pop_back(label n=1)
Reduce size by 1 or more elements. Can be called on an empty list.
void append(const refPtr< T > &ptr)
Move or clone append a tmp to the end of the list.
Ostream & printAddresses(Ostream &os, const bool full=false) const
Print pointer addresses to Ostream (debugging only).
void push_back(T *ptr)
Append an element to the end of the list.
T & emplace_back(Args &&... args)
Construct an element at the end of the list, return reference to the new list element.
void setCapacity_unsafe(label len) noexcept
Change the value for the list capacity directly (ADVANCED, UNSAFE) Does not perform any memory manage...
void operator=(const UPtrList< T > &list)
Copy (clone) assignment.
void swap(PtrList< T > &list)
Swap with plain PtrList content. Implies shrink_to_fit().
void reserve_exact(const label len)
Reserve allocation space for at least this size. If allocation is required, uses the specified size w...
void shrink_to_fit()
Shrink the allocated space to the number of elements used.
void append(PtrDynList< T, AnySizeMin > &&other)
Move append another list to the end of this list.
T & emplace_set(const label i, Args &&... args)
Construct and set a new element at given position, (discard old element at that location)....
void clearStorage()
Clear the list and delete storage.
void resize_null(const label len)
Set the addressed list to the given size, deleting all existing entries. Afterwards the list contains...
autoPtr< T > set(const label i, autoPtr< T > &ptr)
Set element to given autoPtr and return old element.
void append(const tmp< T > &ptr)
Move or clone append a tmp to the end of the list.
autoPtr< T > set(const label i, T *ptr)
Set element to given pointer and return old element (can be null). Auto-sizes list as required.
void append(autoPtr< T > &ptr)
Move append an element to the end of the list.
T & try_emplace(const label i, Args &&... args)
Like emplace_set() but will not overwrite an occupied location.
void append(autoPtr< T > &&ptr)
Move append an element to the end of the list.
label capacity() const noexcept
Size of the underlying storage.
void append(std::unique_ptr< T > &&ptr)
Move append an element to the end of the list.
label squeezeNull()
Squeeze out intermediate nullptr entries in the list of pointers and adjust the addressable size acco...
void resize(const label len)
Alter the addressed list size.
void reserve(const label len)
Reserve allocation space for at least this size.
void clear()
Clear the addressed list, i.e. set the size to zero.
~PtrDynList()
Destructor, sync allocated size before list destruction.
void push_back(autoPtr< T > &ptr)=delete
Disallow push_back with autoPtr without std::move.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
constexpr PtrList() noexcept
Default construct.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
void setAddressableSize(const label n) noexcept
Adjust addressable size.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
T * release() noexcept
Release ownership and return the pointer.
A class for managing references or pointers (no reference counting).
A class for managing temporary objects.
OBJstream os(runTime.globalPath()/outputName)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Foam::argList args(argc, argv)