46 this->checkStart(
range.start());
61 for (label lower = 0; lower < i; ++lower)
63 Foam::Swap(this->
operator[](lower), this->
operator[](i));
73 for (label upper = size()-1; upper > i; --upper)
75 Foam::Swap(this->
operator[](i), this->
operator[](upper));
87 Foam::Swap(this->
operator[](0), this->
operator[](i));
97 const label upper = size()-1;
101 Foam::Swap(this->
operator[](i), this->
operator[](upper));
109 const label len = this->size_;
111 if (len != list.size_)
114 <<
"Lists have different sizes: "
115 << len <<
" != " << list.
size() <<
nl
125 static_cast<void*
>(this->v_), list.v_, this->size_bytes()
133 for (label i = 0; i < len; ++i)
146 const label len = this->size_;
148 if (len != list.
size())
151 <<
"Lists have different sizes: "
152 << len <<
" != " << list.
size() <<
nl
158 for (label i = 0; i < len; ++i)
171 const label len = this->size();
175 for (label i=0; i < len; ++i)
185 const label len = this->size();
189 for (label i=0; i < len; ++i)
204 <<
"Invalid for non-contiguous data types"
207 return this->size_bytes();
214 const label len = this->size();
222 if (list[
pos] == val)
239 if (pos < 0 || pos >= this->size())
241 pos = this->size()-1;
248 if (list[
pos] == val)
265 const label len = this->size_;
266 if (len != list.size_)
276 for (label i = 0; i < len; ++i)
278 equal = (lhs[i] == rhs[i]);
299 lhs < end() && rhs < list.
end();
307 else if (*rhs < *lhs)
314 return (this->size_ < list.size_);
321 return list.operator<(*this);
328 return !list.operator<(*this);
344 std::sort(list.
begin(), list.
end());
348template<
class T,
class Compare>
351 std::sort(list.
begin(), list.
end(), comp);
358 std::stable_sort(list.
begin(), list.
end());
362template<
class T,
class Compare>
365 std::stable_sort(list.
begin(), list.
end(), comp);
372 std::shuffle(list.
begin(), list.
end(), std::default_random_engine());
Macros for accessing List elements.
#define List_ACCESS(type, f, fp)
#define List_CONST_ACCESS(type, f, fp)
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
label size() const noexcept
The number of elements in the list.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void moveLast(const label i)
Move element to the last position.
void swapLast(const label i)
Swap element with the last element. Fatal on an empty list.
iterator begin() noexcept
Return an iterator to begin traversing the UList.
bool operator<(const UList< T > &list) const
Compare two ULists lexicographically. Takes linear time.
const T * const_iterator
Random access iterator for traversing a UList.
void swapFirst(const label i)
Swap element with the first element. Fatal on an empty list.
void deepCopy(const UList< T > &list)
Copy elements of the given UList. Sizes must match!
bool operator>(const UList< T > &a) const
Compare two ULists lexicographically. Takes linear time.
iterator end() noexcept
Return an iterator to end traversing the UList.
label rfind(const T &val, label pos=-1) const
Find index of the last occurrence of the value.
bool operator>=(const UList< T > &a) const
Return true if !(a < b). Takes linear time.
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
std::streamsize byteSize() const
bool operator<=(const UList< T > &a) const
Return true if !(a > b). Takes linear time.
void moveFirst(const label i)
Move element to the first position.
void size(const label n)
Older name for setAddressableSize.
labelRange validateRange(const labelRange &requestedRange) const
UList< T > & operator=(const UList< T > &)=delete
No copy assignment (default: shallow copy)
A range or interval of labels defined by a start and a size.
labelRange subset0(const label size) const
Calculate the intersection with the given 0/size range.
friend bool operator!=(const refineCell &rc1, const refineCell &rc2)
friend bool operator==(const refineCell &rc1, const refineCell &rc2)
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 shuffle(UList< T > &list)
Randomise the list order.
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
void sort(UList< T > &list)
Sort the list.
errorManip< error > abort(error &err)
bool operator<(const IOstreamOption::versionNumber &a, const IOstreamOption::versionNumber &b) noexcept
Version A older than B.
void stableSort(UList< T > &list)
Stable sort the list.
constexpr char nl
The newline '\n' character (0x0a)
A template class to specify that a data type can be considered as being contiguous in memory.