Go to the documentation of this file.
55 return NullObjectRef<UList<T>>();
62 return (i == size()-1 ? 0 : i+1);
69 return (i ? i-1 : size()-1);
76 return this->operator[](this->fcIndex(i));
83 return this->operator[](this->fcIndex(i));
90 return this->operator[](this->rcIndex(i));
97 return this->operator[](this->rcIndex(i));
104 if (start < 0 || (start && start >= size_))
108 <<
"start " << start <<
" out of range [0,"
118 if (size < 0 || size > size_)
121 <<
"size " << size <<
" out of range [0,"
142 <<
"size " << len <<
" is negative, out of range [0,"
146 this->checkStart(start);
147 this->checkSize(start + len);
153 this->checkSize(start);
164 <<
"attempt to access element " << i <<
" from zero sized list"
167 else if (i < 0 || i >= size_)
170 <<
"index " << i <<
" out of range [0,"
180 const label len = size();
187 const T& val = (*this)[0];
189 for (label i = 1; i < len; ++i)
191 if (val != (*
this)[i])
204 return this->operator[](0);
211 return this->operator[](0);
218 return this->operator[](this->size()-1);
225 return this->operator[](this->size()-1);
246 return reinterpret_cast<const char*
>(v_);
253 return reinterpret_cast<char*
>(v_);
260 return std::streamsize(size_)*
sizeof(
T);
267 return (this->
find(val,
pos) >= 0);
288 if (i >= 0 && i < size_)
321 return *
reinterpret_cast<const List<T>*
>(
this);
441 std::swap(size_, list.size_);
442 std::swap(v_, list.v_);
451 for (label i=0; i<
n/2; ++i)
const char * cdata_bytes() const noexcept
Return pointer to the underlying array serving as data storage,.
void reverse(UList< T > &list, const label n)
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
const T * cdata() const noexcept
Return pointer to the underlying array serving as data storage.
label rcIndex(const label i) const noexcept
constexpr auto begin(C &c) -> decltype(c.begin())
Return iterator to the beginning of the container c.
iterator end() noexcept
Return an iterator to end traversing the UList.
T & first()
Return the first element of the list.
constexpr UList() noexcept
Default construct, zero-sized and nullptr.
void setAddressableSize(const label n) noexcept
Set addressed size to be inconsistent with allocated storage.
void checkSize(const label size) const
Check size is within valid range [0,size].
bool uniform() const
True if all entries have identical values, and list is non-empty.
char * data_bytes() noexcept
Return pointer to the underlying array serving as data storage,.
label fcIndex(const label i) const noexcept
void checkRange(const label start, const label len) const
Check that start and length define a valid range.
void checkStart(const label start) const
Check start is within valid range [0,size)
iterator begin() noexcept
Return an iterator to begin traversing the UList.
const_iterator cend() const noexcept
Return const_iterator to end traversing the constant UList.
T * iterator
Random access iterator for traversing a UList.
T & last()
Return the last element of the list.
const_reverse_iterator crend() const
Return const_reverse_iterator to end reverse traversing the UList.
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
T * data() noexcept
Return pointer to the underlying array serving as data storage.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
label find(const ListType &input, const UnaryPredicate &pred, const label start=0)
Find index of the first occurrence that satisfies the predicate.
errorManip< error > abort(error &err)
reverse_iterator rend()
Return reverse_iterator to end reverse traversing the UList.
const T & fcValue(const label i) const
Return forward circular value (ie, next value in the list)
const_iterator cbegin() const noexcept
Return const_iterator to begin traversing the constant UList.
void shallowCopy(const UList< T > &list)
Copy the pointer and size held by the given UList.
void swap(UList< T > &list)
Swap content with another UList of the same type in constant time.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
reverse_iterator rbegin()
Return reverse_iterator to begin reverse traversing the UList.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A traits class, which is primarily used for primitives.
T & operator[](const label i)
Return element of UList.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
label size() const noexcept
The number of elements in the UList.
bool found(const T &val, label pos=0) const
True if the value if found in the list.
std::reverse_iterator< const_iterator > const_reverse_iterator
Reverse iterator (const access)
void size(const label n)
Older name for setAddressableSize.
static const UList< T > & null()
Return a UList reference to a nullObject.
std::reverse_iterator< iterator > reverse_iterator
Reverse iterator (non-const access)
void checkIndex(const label i) const
Check index is within valid range [0,size)
std::streamsize size_bytes() const noexcept
Number of contiguous bytes for the List data.
const T & rcValue(const label i) const
Return reverse circular value (ie, previous value in the list)
const_reverse_iterator crbegin() const
Return const_reverse_iterator to begin reverse traversing the UList.
dimensionedScalar pos(const dimensionedScalar &ds)