45#ifndef Foam_DynamicList_H
46#define Foam_DynamicList_H
56template<
class T,
int SizeMin>
class DynamicList;
58template<
class T,
int SizeMin>
59Istream&
operator>>(Istream& is, DynamicList<T, SizeMin>& list);
61template<
class T,
int SizeMin>
62Ostream&
operator<<(Ostream&
os,
const DynamicList<T, SizeMin>& list);
69template<
class T,
int SizeMin = 16>
74 static_assert(SizeMin > 0,
"Invalid min size parameter");
91 template<
class ListType>
92 inline void assignDynList(
const ListType& list);
96 inline void doCapacity(
const bool nocopy,
const label len);
101 inline void doReserve(
const bool nocopy,
const label len);
106 inline void doResize(
const bool nocopy,
const label len);
129 template<
int AnySizeMin>
141 inline explicit DynamicList(std::initializer_list<T> lst);
151 template<
int AnySizeMin>
197 inline
void reserve(const label len);
210 inline
void resize(const label len);
213 inline
void resize(const label len, const
T& val);
249 template<
int AnySizeMin>
256 template<
int AnySizeMin>
260 inline
void append(const
T& val);
273 inline
void append(std::initializer_list<
T> lst);
283 template<
int AnySizeMin>
299 inline
T remove(const label idx, const
bool fast=false);
308 inline label
remove(std::initializer_list<label> start_size);
317 inline label
subset(std::initializer_list<label> start_size);
342 template<
int AnySizeMin>
346 inline
void operator=(std::initializer_list<
T> lst);
359 template<
int AnySizeMin>
390template<class
T,
int SizeMin>
393 return list.readList(is);
398template<
class T,
int SizeMin>
401 return (
os <<
static_cast<const UList<T>&
>(list));
408template<
class T,
int SizeMinA,
int SizeMinB>
418template<
class T,
int SizeMin>
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 swap(DynamicList< T, AnySizeMin > &other)
Swap content, independent of sizing parameter.
DynamicList< T, SizeMin > & shrink()
Shrink the allocated space to the number of elements used.
T remove()
Remove and return the last element. Fatal on an empty list.
void transfer(List< T > &list)
Transfer contents of the argument List into this.
void setSize(const label n)
Same as resize()
void resize_nocopy(const label len)
void setCapacity_nocopy(const label len)
void reserve_nocopy(const label len)
void setCapacity_unsafe(const label len) noexcept
std::streamsize capacity_bytes() const noexcept
Number of contiguous bytes of the underlying storage.
void append(const T &val)
Copy append an element to the end of this list.
void clearStorage()
Clear the list and delete storage.
label appendUniq(const T &val)
Append an element if not already in the list.
label capacity() const noexcept
Size of the underlying storage.
void setSize(const label n, const T &val)
Same as resize()
void shrinkStorage()
Shrink the allocated space to the number of elements used.
label expandStorage() noexcept
Expand the addressable size to fit the allocated capacity.
static constexpr label min_size() noexcept
Normal lower capacity limit - the SizeMin template parameter.
friend Ostream & operator(Ostream &os, const DynamicList< T, SizeMin > &list)
Write to Ostream.
void resize(const label len)
void reserve(const label len)
label subset(const labelRange &range)
Retain a (start,size) subset from the list.
void setCapacity(const label len)
Alter the size of the underlying storage.
Istream & readList(Istream &is)
Read from Istream, discarding existing contents.
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.
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)
Istream & operator>>(Istream &, directionInfo &)
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"))