45 #ifndef Foam_DynamicList_H 46 #define Foam_DynamicList_H 58 template<
class T,
int SizeMin>
61 template<
class T,
int SizeMin>
62 Ostream& operator<<(Ostream& os, const DynamicList<T, SizeMin>& list);
69 template<
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(
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);
110 bool readBracketList(
Istream& is);
121 inline explicit DynamicList(
const label initialCapacity);
133 template<
int AnySizeMin>
148 inline explicit DynamicList(std::initializer_list<T> lst);
158 template<
int AnySizeMin>
204 inline void reserve(
const label len);
217 inline void resize(
const label len);
220 inline void resize(
const label len,
const T& val);
262 template<
int AnySizeMin>
269 template<
int AnySizeMin>
274 template<class... Args>
288 inline
void push_back(const FixedList<
T,
N>& list);
295 inline
void push_back(const IndirectListBase<
T, Addr>& lst);
301 template<
int AnySizeMin>
323 inline
T remove(const label idx, const
bool fast=false);
332 inline label
remove(
std::initializer_list<label> start_size);
340 inline label
subset(
std::initializer_list<label> start_size);
365 template<
int AnySizeMin>
382 template<
int AnySizeMin>
433 void append(
const IndirectListBase<T, Addr>& list)
443 template<
int AnySizeMin>
444 void append(DynamicList<T, AnySizeMin>&& list)
458 template<
class T,
int SizeMin>
459 Istream&
operator>>(Istream& is, DynamicList<T, SizeMin>& list)
461 return list.readList(is);
466 template<
class T,
int SizeMin>
467 Ostream& operator<<(Ostream& os, const DynamicList<T, SizeMin>& list)
469 return (
os <<
static_cast<const UList<T>&
>(list));
476 template<
class T,
int SizeMin>
477 struct Hash<DynamicList<
T, SizeMin>> : List<T>::hasher {};
491 template<
class T,
int SizeMinA,
int SizeMinB>
492 inline void Swap(DynamicList<T, SizeMinA>& a, DynamicList<T, SizeMinB>&
b)
friend Ostream & operator(Ostream &os, const DynamicList< T, SizeMin > &list)
Write to Ostream.
A 1D vector of objects of type <T> with a fixed length <N>.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void reserve_nocopy(const label len)
Reserve allocation space for at least this size, allocating new space if required without retaining o...
constexpr DynamicList() noexcept
Default construct, an empty list without allocation.
A range or interval of labels defined by a start and a size.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
void shrink_unsafe()
Shrink the internal bookkeeping of the allocated space to the number of addressed elements without af...
void resize(const label len)
Alter addressable list size, allocating new space if required while recovering old content...
label appendUniq(const T &val)
Same as push_uniq()
void setCapacity(const label len)
Alter the size of the underlying storage.
void setSize(const label n)
Same as resize()
void resize_fill(const label len, const T &val)
Alter addressable size and set val for all addressed entries.
void pop_back(label n=1)
Reduce size by 1 or more elements. Can be called on an empty list.
Base for lists with indirect addressing, templated on the list contents type and the addressing type...
void shrink_to_fit()
Shrink the allocated space to the number of elements used.
friend class List< T >
Declare friendship with the List class.
label capacity() const noexcept
Size of the underlying storage.
static constexpr label min_size() noexcept
Normal lower capacity limit - the SizeMin template parameter.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
SubList< T > slice(const label pos, label len=-1)
Return SubList slice (non-const access) - no range checking.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
T & emplace_back(Args &&... args)
Construct an element at the end of the list, return reference to the new list element.
Istream & operator>>(Istream &, directionInfo &)
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.
#define FOAM_DEPRECATED_STRICT(since, replacement)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void reserve(const label len)
Reserve allocation space for at least this size, allocating new space if required and retaining old c...
Istream & readList(Istream &is)
Read from Istream, discarding existing contents.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
void setCapacity_unsafe(const label len) noexcept
Change the value for the list capacity directly (ADVANCED, UNSAFE) Does not perform any memory manage...
DynamicList< T, SizeMin > & shrink()
Calls shrink_to_fit() and returns a reference to the DynamicList.
OBJstream os(runTime.globalPath()/outputName)
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
void push_back(const T &val)
Copy append an element to the end of this list.
void swap(List< T > &list)
Swap with plain List content. Implies shrink_to_fit().
const Vector< label > N(dict.get< Vector< label >>("N"))
label push_uniq(const T &val)
Append an element if not already in the list.
T remove()
Remove and return the last element. Fatal on an empty list.
constexpr UList() noexcept
Default construct, zero-sized and nullptr.
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
Exchange contents of lists - see DynamicList::swap().
void transfer(List< T > &list)
Transfer contents of the argument List into this.
void clearStorage()
Clear the list and delete storage.
label subset(const labelRange &range)
Retain a (start,size) subset from the list.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
void resize_nocopy(const label len)
Alter addressable list size, allocating new space if required without necessarily recovering old cont...
Foam::argList args(argc, argv)
constexpr List() noexcept
Default construct.
void setCapacity_nocopy(const label len)
Alter the size of the underlying storage, without retaining old content.