37 this->v_ =
new T[this->size_];
45 if (this->size_ != len)
55 template<
class ListType>
61 const label len = this->size_;
65 for (label i = 0; i < len; (void)++i, (
void)++iter)
73 template<
class ListType,
class ListIndices>
77 const ListIndices& indices
83 const label len = this->size_;
87 for (label i = 0; i < len; (void)++i, (
void)++iter)
89 *iter = list[indices[i]];
95 template<
class InputIterator>
98 InputIterator firstIter,
99 InputIterator lastIter,
103 UList<
T>(nullptr, len)
112 for (label i = 0; i < len; (void)++i, (
void)++firstIter)
114 this->v_[i] = *firstIter;
154 this->
resize(newLen,
false);
191 label
n = this->size();
211 template<
class... Args>
218 const label idx = this->size();
229 const label idx = this->size();
239 const label idx = this->size();
255 const label idx = this->size();
270 const label idx = this->size();
271 const label
n = list.
size();
275 auto iter = this->
begin(idx);
277 for (label i = 0; i <
n; (void)++i, (
void)++iter)
287 if (this->contains(val))
293 this->push_back(val);
302 if (
n >= this->size())
void size(const label n)
Older name for setAddressableSize.
void pop_back(label n=1)
Reduce size by 1 or more elements. Can be called on an empty list.
patchWriters resize(patchIds.size())
void resize(const label len)
Adjust allocated size of list.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
void resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
void resize_fill(const label len, const T &val)
Adjust allocated size of list and set val for all elements.
void push_back(const T &val)
Append an element at the end of the list.
label push_uniq(const T &val)
Append an element if not already in the list.
Base for lists with indirect addressing, templated on the list contents type and the addressing type...
void operator=(const UList< T > &list)
Assignment to UList operator. Takes linear time.
void clear()
Clear the list, i.e. set size to zero.
label size() const noexcept
The number of elements in the list.
errorManip< error > abort(error &err)
iterator begin() noexcept
Return an iterator to begin traversing the UList.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void resize_unsafe(const label len) noexcept
Change the addressed list size directly without affecting any memory management (advanced usage)...
T & emplace_back(Args &&... args)
Construct an element at the end of the list, return reference to the new list element.
T & newElmt(const label i)
Return subscript-checked element of UList and resizing the list if required.
autoPtr< List< T > > clone() const
Clone.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
iterator end() noexcept
Return an iterator to end traversing the UList.
Foam::argList args(argc, argv)
constexpr auto begin(C &c) -> decltype(c.begin())
Return iterator to the beginning of the container c.
constexpr List() noexcept
Default construct.