Go to the documentation of this file.
44 this->checkStart(slice.
start());
45 this->checkSize(slice.
start() + slice.
size());
85 Foam::Swap(this->
operator[](0), this->
operator[](i));
95 const label
upper = size()-1;
99 Foam::Swap(this->
operator[](i), this->
operator[](upper));
107 const label len = this->size_;
109 if (len != list.size_)
112 <<
"ULists have different sizes: "
113 << len <<
" " << list.size_
123 static_cast<void*
>(this->v_), list.v_, this->byteSize()
131 for (label i = 0; i < len; ++i)
163 const label len = this->size();
167 for (label i=0; i < len; ++i)
177 const label len = this->size();
181 for (label i=0; i < len; ++i)
196 <<
"Cannot return binary size of a list with non-primitive elements"
200 return this->size_*
sizeof(
T);
207 const label len = this->size();
215 if (list[
pos] == val)
232 if (pos < 0 || pos >= this->size())
234 pos = this->size()-1;
241 if (list[
pos] == val)
260 template<
class T,
class Compare>
270 std::stable_sort(a.
begin(), a.
end());
274 template<
class T,
class Compare>
277 std::stable_sort(a.
begin(), a.
end(), comp);
284 std::random_shuffle(a.
begin(), a.
end());
293 const label len = this->size_;
294 if (len != list.size_)
304 for (label i = 0; i < len; ++i)
306 equal = (lhs[i] == rhs[i]);
326 const_iterator lhs =
begin(), rhs = list.
begin();
327 lhs <
end() && rhs < list.
end();
335 else if (*rhs < *lhs)
342 return (this->size_ < list.size_);
349 return list.operator<(*this);
356 return !list.operator<(*this);
bool operator<(const UList< T > &list) const
Compare two ULists lexicographically. Takes linear time.
constexpr auto begin(C &c) -> decltype(c.begin())
Return iterator to the beginning of the container c.
labelRange validateRange(const labelRange &range) const
bool operator>=(const UList< T > &a) const
Return true if !(a < b). Takes linear time.
static constexpr const zero Zero
Global zero (0)
bool operator==(const UList< T > &a) const
Equality operation on ULists of the same type.
bool operator<=(const UList< T > &a) const
Return true if !(a > b). Takes linear time.
label size() const noexcept
The effective size of the range.
void deepCopy(const UList< T > &list)
Copy elements of the given UList.
void Swap(DynamicList< T, SizeMin1 > &a, DynamicList< T, SizeMin2 > &b)
void swapFirst(const label i)
Swap element with the first element. Fatal on an empty list.
iterator begin()
Return an iterator to begin traversing the UList.
void stableSort(UList< T > &a)
label rfind(const T &val, label pos=-1) const
Find index of the last occurrence of the value.
string lower(const std::string &s)
Return string copy transformed with std::tolower on each character.
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
void swapLast(const label i)
Swap element with the last element. Fatal on an empty list.
void moveFirst(const label i)
Move element to the first position.
bool operator!=(const UList< T > &a) const
The opposite of the equality operation. Takes linear time.
A range or interval of labels defined by a start and a size.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
errorManip< error > abort(error &err)
bool operator>(const UList< T > &a) const
Compare two ULists lexicographically. Takes linear time.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define List_CONST_ACCESS(type, f, fp)
void shuffle(UList< T > &a)
T & operator[](const label i)
Return element of UList.
UList< T > & operator=(const UList< T > &)=delete
No copy assignment (default: shallow copy)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
label start() const noexcept
The (inclusive) lower value of the range.
std::streamsize byteSize() const
bool operator<(const IOstreamOption::versionNumber &a, const IOstreamOption::versionNumber &b) noexcept
Version A older than B.
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
iterator end()
Return an iterator to end traversing the UList.
void moveLast(const label i)
Move element to the last position.
#define List_ACCESS(type, f, fp)
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
A template class to specify that a data type can be considered as being contiguous in memory.
Macros for accessing List elements.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
dimensionedScalar pos(const dimensionedScalar &ds)