60 this->v_, this->size_, val
68 if constexpr (std::is_arithmetic_v<T>)
75 this->v_, this->size_,
T(0)
78 else if constexpr (is_contiguous_v<T>)
85 this->data_bytes(), this->size_bytes(),
char(0)
93 const auto last = (this->v_ + this->size_);
95 for (
auto first = this->v_; (first != last); (void)++first)
108 return (i ==
size()-1 ? 0 : i+1);
115 return (i ? i-1 :
size()-1);
150 if (start < 0 || (start && start >= size_))
154 <<
"start " << start <<
" out of range [0,"
164 if (size < 0 || size > size_)
167 <<
"size " << size <<
" out of range [0,"
188 <<
"size " << len <<
" is negative, out of range [0,"
190 << abort(FatalError);
192 this->checkStart(start);
193 this->checkSize(start + len);
210 <<
"attempt to access element " << i <<
" from zero sized list"
211 << abort(FatalError);
213 else if (i < 0 || i >= size_)
216 <<
"index " << i <<
" out of range [0,"
233 for (label i = 1; i < size_; ++i)
235 if (this->v_[0] != this->v_[i])
290 return reinterpret_cast<const char*
>(v_);
297 return reinterpret_cast<char*
>(v_);
304 return std::streamsize(size_)*
sizeof(
T);
311 const auto iter = std::find(this->
begin(), this->
end(), val);
312 return (iter != this->
end());
319 return (this->
find(val,
pos, len) >= 0);
372 if constexpr (std::is_same_v<bool, std::remove_cv_t<T>>)
377 if (i < 0 || i >= size_)
395 if constexpr (std::is_same_v<bool, std::remove_cv_t<T>>)
398 if (i < 0 || i >= size_)
441 return (v_ + (i < 0 ? 0 : size_ < i ? size_ : i));
448 return (v_ + (i < 0 ? 0 : size_ < i ? size_ : i));
455 return (v_ + (i < 0 ? 0 : size_ < i ? size_ : i));
538 std::swap(size_, list.size_);
539 std::swap(v_, list.v_);
548 const label nBy2 =
n/2;
550 for (label i = 0; i < nBy2; ++i)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void shallowCopy(T *__restrict__ ptr, const label len) noexcept
Copy the pointer and size.
const_reverse_iterator crbegin() const
Return const_reverse_iterator to begin reverse traversing the UList.
void fill_uniform(const T &val)
Assign all entries to the given value.
T & first()
Access first element of the list, position [0].
iterator begin() noexcept
Return an iterator to begin traversing the UList.
char * data_bytes() noexcept
Return pointer to the underlying array serving as data storage,.
const_reverse_iterator crend() const
Return const_reverse_iterator to end reverse traversing the UList.
const T * const_iterator
Random access iterator for traversing a UList.
void checkIndex(const label i) const
Check index is within valid range [0,size).
T * iterator
Random access iterator for traversing a UList.
UList(const UList< CloudFunctionObject< CloudType > * > &) noexcept=default
std::reverse_iterator< const_iterator > const_reverse_iterator
Reverse iterator (const access).
bool contains(const T &val) const
True if the value is contained in the list.
const T & rcValue(const label i) const
Return reverse circular value (ie, previous value in the list).
T & back()
Access last element of the list, position [size()-1].
iterator end() noexcept
Return an iterator to end traversing the UList.
const_iterator cend() const noexcept
Return const_iterator to end traversing the constant UList.
const T * cdata() const noexcept
Return pointer to the underlying array serving as data storage.
constexpr UList() noexcept
Default construct, zero-sized and nullptr.
reverse_iterator rbegin()
Return reverse_iterator to begin reverse traversing the UList.
void swap(UList< T > &list) noexcept
Swap content with another UList of the same type in constant time.
const_iterator cbegin() const noexcept
Return const_iterator to begin traversing the constant UList.
const T & fcValue(const label i) const
Return forward circular value (ie, next value in the list).
label rcIndex(const label i) const noexcept
The reverse circular index. The previous index in the list which returns to the last at the beginning...
std::reverse_iterator< iterator > reverse_iterator
Reverse iterator (non-const access).
T * data() noexcept
Return pointer to the underlying array serving as data storage.
T & front()
Access first element of the list, position [0].
bool uniform() const
True if all entries have identical values, and list is non-empty.
void checkSize(const label size) const
Check size is within valid range [0,size].
const char * cdata_bytes() const noexcept
Return pointer to the underlying array serving as data storage,.
reverse_iterator rend()
Return reverse_iterator to end reverse traversing the UList.
void size(const label n)
Older name for setAddressableSize.
std::streamsize size_bytes() const noexcept
Number of contiguous bytes for the List data.
void checkRange(const label start, const label len) const
Check that start and length define a valid range.
void setAddressableSize(const label n) noexcept
Set addressed size to be inconsistent with allocated storage.
T & operator[](const label i)
Return element of UList.
T & last()
Access last element of the list, position [size()-1].
UList< T > & operator=(const UList< T > &)=delete
No copy assignment (default: shallow copy).
label find(const T &val) const
Find index of the first occurrence of the value.
label fcIndex(const label i) const noexcept
The forward circular index. The next index in the list which returns to the first at the end of the l...
void checkStart(const label start) const
Check start is within valid range [0,size).
A traits class, which is primarily used for primitives and vector-space.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedScalar pos(const dimensionedScalar &ds)
void reverse(UList< T > &list, const label n)
Reverse the first n elements of the list.
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
Exchange contents of lists - see DynamicList::swap().
errorManip< error > abort(error &err)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
constexpr bool is_contiguous_v
The is_contiguous value of Type (after stripping of qualifiers).
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)