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);
129 template<
int AnySizeMin>
144 inline explicit DynamicList(std::initializer_list<T> lst);
154 template<
int AnySizeMin>
200 inline void reserve(
const label len);
213 inline void resize(
const label len);
216 inline void resize(
const label len,
const T& val);
252 template<
int AnySizeMin>
259 template<
int AnySizeMin>
264 template<class... Args>
278 inline
void push_back(const FixedList<
T,
N>& list);
285 inline
void push_back(const IndirectListBase<
T, Addr>& lst);
291 template<
int AnySizeMin>
313 inline
T remove(const label idx, const
bool fast=false);
322 inline label
remove(
std::initializer_list<label> start_size);
331 inline label
subset(
std::initializer_list<label> start_size);
356 template<
int AnySizeMin>
373 template<
int AnySizeMin>
424 void append(
const IndirectListBase<T, Addr>& list)
434 template<
int AnySizeMin>
435 void append(DynamicList<T, AnySizeMin>&& list)
449 template<
class T,
int SizeMin>
450 Istream&
operator>>(Istream& is, DynamicList<T, SizeMin>& list)
452 return list.readList(is);
457 template<
class T,
int SizeMin>
458 Ostream& operator<<(Ostream& os, const DynamicList<T, SizeMin>& list)
460 return (
os <<
static_cast<const UList<T>&
>(list));
467 template<
class T,
int SizeMinA,
int SizeMinB>
468 inline void Swap(DynamicList<T, SizeMinA>& a, DynamicList<T, SizeMinB>&
b)
477 template<
class T,
int SizeMin>
478 struct Hash<DynamicList<
T, SizeMin>> : List<T>::hasher {};
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>.
label expandStorage() noexcept
Expand the addressable size to fit the allocated capacity.
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 resize(const label len)
Alter addressable list size, allocating new space if required while recovering old content...
label appendUniq(const T &val)
Append an element if not already in the list.
void setCapacity(const label len)
Alter the size of the underlying storage.
void shrinkStorage()
Shrink the allocated space to the number of elements used.
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.
Base for lists with indirect addressing, templated on the list contents type and the addressing type...
void swap(DynamicList< T, AnySizeMin > &other)
Swap content, independent of sizing parameter.
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.
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()
Shrink the allocated space to the number of elements used.
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.
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)
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.