45 this->checkStart(
range.start());
86 Foam::Swap(this->
operator[](0), this->
operator[](i));
96 const label
upper = size()-1;
100 Foam::Swap(this->
operator[](i), this->
operator[](upper));
108 const label len = this->size_;
110 if (len != list.size_)
113 <<
"Lists have different sizes: " 114 << len <<
" != " << list.size() <<
nl 120 if (is_contiguous<T>::value)
124 static_cast<void*>(this->v_), list.v_, this->size_bytes()
132 for (label i = 0; i < len; ++i)
145 const label len = this->size_;
147 if (len != list.size())
150 <<
"Lists have different sizes: " 151 << len <<
" != " << list.size() <<
nl 157 for (label i = 0; i < len; ++i)
170 const label len = this->size();
174 for (label i=0; i < len; ++i)
184 const label len = this->size();
188 for (label i=0; i < len; ++i)
200 if (!is_contiguous<T>::value)
203 <<
"Invalid for non-contiguous data types" 206 return this->size_bytes();
213 const label len = this->size();
221 if (list[
pos] == val)
238 if (pos < 0 || pos >= this->size())
240 pos = this->size()-1;
247 if (list[
pos] == val)
264 const label len = this->size_;
265 if (len != list.size_)
275 for (label i = 0; i < len; ++i)
277 equal = (lhs[i] == rhs[i]);
297 const_iterator lhs =
begin(), rhs = list.
begin();
298 lhs <
end() && rhs < list.
end();
306 else if (*rhs < *lhs)
313 return (this->size_ < list.size_);
320 return list.operator<(*this);
327 return !list.operator<(*this);
347 template<
class T,
class Compare>
357 std::stable_sort(list.
begin(), list.
end());
361 template<
class T,
class Compare>
364 std::stable_sort(list.
begin(), list.
end(), comp);
371 std::shuffle(list.begin(), list.end(), std::default_random_engine());
#define List_CONST_ACCESS(type, f, fp)
void swapLast(const label i)
Swap element with the last element. Fatal on an empty list.
void swapFirst(const label i)
Swap element with the first element. Fatal on an empty 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.
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
A range or interval of labels defined by a start and a size.
constexpr char nl
The newline '\n' character (0x0a)
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
void stableSort(UList< T > &list)
Stable sort the list.
labelRange validateRange(const labelRange &requestedRange) const
Return a validated (start,size) subset range, which means that it always addresses a valid section of...
bool operator>(const UList< T > &a) const
Compare two ULists lexicographically. Takes linear time.
bool operator<(const IOstreamOption::versionNumber &a, const IOstreamOption::versionNumber &b) noexcept
Version A older than B.
labelRange subset0(const label size) const
Calculate the intersection with the given 0/size range.
UList< T > & operator=(const UList< T > &)=delete
No copy assignment (default: shallow copy)
dimensionedScalar pos(const dimensionedScalar &ds)
void sort(UList< T > &list)
Sort the list.
bool operator==(const UList< T > &a) const
Equality operation on ULists of the same type.
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.
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...
Macros for accessing List elements.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
#define List_ACCESS(type, f, fp)
bool operator<(const UList< T > &list) const
Compare two ULists lexicographically. Takes linear time.
void moveLast(const label i)
Move element to the last position.
bool operator!=(const UList< T > &a) const
The opposite of the equality operation. Takes linear time.
string lower(const std::string &s)
Return string copy transformed with std::tolower on each character.
std::streamsize byteSize() const
Number of contiguous bytes for the List data, runtime FatalError if type is not contiguous.
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
bool operator<=(const UList< T > &a) const
Return true if !(a > b). Takes linear time.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
void deepCopy(const UList< T > &list)
Copy elements of the given UList. Sizes must match!
iterator end() noexcept
Return an iterator to end traversing the UList.
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
void shuffle(UList< T > &list)
Randomise the list order.
void moveFirst(const label i)
Move element to the first position.
constexpr auto begin(C &c) -> decltype(c.begin())
Return iterator to the beginning of the container c.
static constexpr const zero Zero
Global zero (0)