45#ifndef Foam_DynamicList_H
46#define Foam_DynamicList_H
58template<
class T,
int SizeMin>
61template<
class T,
int SizeMin>
69template<
class T,
int SizeMin = 16>
74 static_assert(SizeMin > 0,
"Invalid min size parameter");
91 template<
class ListType>
92 inline void doAssignDynList(
const ListType& list);
96 inline void doCapacity_copy(label count,
const label len);
101 inline void doReserve_copy(label count,
const label len);
105 bool readBracketList(
Istream& is);
116 inline explicit DynamicList(
const label initialCapacity);
119 inline explicit DynamicList(std::pair<label,label> sizing);
131 template<
int AnySizeMin>
146 inline explicit DynamicList(std::initializer_list<T> lst);
156 template<
int AnySizeMin>
225 inline void resize(
const label len);
228 inline void resize(
const label len,
const T& val);
257 inline
void swap(List<
T>& other);
260 template<
int AnySizeMin>
267 template<
int AnySizeMin>
272 template<class... Args>
289 inline
void push_back(std::initializer_list<
T> list);
299 template<
int AnySizeMin>
321 inline
T remove(const label idx, const
bool fast=false);
330 inline label
remove(std::initializer_list<label> start_size);
338 inline label
subset(std::initializer_list<label> start_size);
363 template<
int AnySizeMin>
367 inline
void operator=(std::initializer_list<
T> lst);
380 template<
int AnySizeMin>
455 template<
int AnySizeMin>
470template<
class T,
int SizeMin>
478template<
class T,
int SizeMin>
481 return (
os <<
static_cast<const UList<T>&
>(list));
488template<
class T,
int SizeMin>
489struct Hash<
DynamicList<
T, SizeMin>> : List<T>::hasher {};
503template<
class T,
int SizeMinA,
int SizeMinB>
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
constexpr DynamicList() noexcept
Default construct, an empty list without allocation.
void transfer(List< float > &list)
void append(std::initializer_list< T > list)
Append an initializer list at the end of this list.
void setSize(const label n)
label appendUniq(const float &val)
void resize_nocopy(const label len)
Alter addressable list size, allocating new space if required without necessarily recovering old cont...
void setCapacity_nocopy(const label len)
float & emplace_back(Args &&... args)
void setCapacity_unsafe(label len) noexcept
void append(DynamicList< T, AnySizeMin > &&list)
Move append list.
void append(const IndirectListBase< T, Addr > &list)
Append a IndirectList at the end of this list.
void reserve_nocopy(const label len)
Reserve allocation space for at least this size, allocating new space if required without retaining o...
void reserve_exact(const label len)
Reserve allocation space for at least this size, allocating new space if required and retaining old c...
std::streamsize capacity_bytes() const noexcept
Number of contiguous bytes of the underlying storage.
DynamicList(const DynamicList< T, SizeMin > &lst)
Copy construct.
void resize_copy(label count, const label len)
Alter addressable size, retaining the first count contents.
void append(const T &val)
Copy append an element to the end of this list.
void resize(const label len, const T &val)
Alter addressable size and fill new entries with constant value.
void append(List< T > &&list)
Move append list.
~DynamicList()
Destructor, sync allocated size before List destruction.
void swap(List< float > &other)
void append(T &&val)
Move append an element.
label push_uniq(const float &val)
void setSize(const label n, const T &val)
Alias for resize().
void append(const FixedList< T, N > &list)
Append a FixedList to the end of this list.
void push_back(const float &val)
DynamicList< T, SizeMin > & shrink()
Calls shrink_to_fit() and returns a reference to the DynamicList.
static constexpr label min_size() noexcept
Normal lower capacity limit - the SizeMin template parameter.
label capacity() const noexcept
Size of the underlying storage.
friend Ostream & operator(Ostream &os, const DynamicList< float, 16 > &list)
void resize(const label len)
Alter addressable list size, allocating new space if required while recovering old content.
void reserve(const label len)
Reserve allocation space for at least this size, allocating new space if required and retaining old c...
label subset(const labelRange &range)
void resize_fill(const label len, const T &val)
Alter addressable size and set val for all addressed entries.
void setCapacity(const label len)
Istream & readList(Istream &is)
void append(const UList< T > &list)
Append another list to the end of this list.
DynamicList(const UList< T > &lst)
Copy construct from UList. Size set to UList size.
A 1D vector of objects of type <T> with a fixed length <N>.
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
SubList< T > slice(const label pos, label len=-1)
Return SubList slice (non-const access) - no range checking.
void setAddressableSize(const label n) noexcept
Set addressed size to be inconsistent with allocated storage.
A range or interval of labels defined by a start and a size.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
OBJstream os(runTime.globalPath()/outputName)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
Exchange contents of lists - see DynamicList::swap().
Istream & operator>>(Istream &, directionInfo &)
UList< label > labelUList
A UList of labels.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Foam::argList args(argc, argv)
#define FOAM_DEPRECATED_FOR(since, replacement)
Hash function class. The default definition is for primitives. Non-primitives used to hash entries on...
const Vector< label > N(dict.get< Vector< label > >("N"))