Go to the documentation of this file.
60 #include <initializer_list>
62 #include <type_traits>
72 template<
class T>
class List;
73 template<
class T>
class SubList;
74 template<
class T>
class UList;
75 template<
class T> Istream&
operator>>(Istream&, UList<T>&);
76 template<
class T> Ostream&
operator<<(Ostream&,
const UList<T>&);
106 inline void size(
const label
n) noexcept;
165 friend class List<
T>;
174 inline static const UList<T>&
null();
189 bool operator()(
const label a,
const label
b)
const
205 bool operator()(
const label a,
const label
b)
const
221 inline constexpr
UList() noexcept;
224 inline
UList(
T* __restrict__ v, label
size) noexcept;
233 inline label
fcIndex(const label i) const;
236 inline const
T&
fcValue(const label i) const;
243 inline label
rcIndex(const label i) const;
246 inline const
T&
rcValue(const label i) const;
261 inline const
T*
cdata() const;
272 inline const
T&
first() const;
278 inline const
T&
last() const;
284 inline
void checkStart(const label start) const;
302 label
find(const
T& val, label
pos = 0) const;
308 label
rfind(const
T& val, label
pos = -1) const;
314 inline
bool found(const
T& val, label
pos = 0) const;
344 inline
T& operator[](const label i);
349 inline const
T& operator[](const label i) const;
362 inline operator const
Foam::
List<
T>&() const;
365 void operator=(const
T& val);
422 inline label
size() const noexcept;
425 inline
bool empty() const noexcept;
483 template<
class TypeT = T>
484 typename std::enable_if<std::is_same<bool, TypeT>::value,
bool>
::type
485 inline test(
const label i)
const
487 return (i >= 0 && i <
size() && v_[i]);
493 template<
class TypeT = T>
494 typename std::enable_if<std::is_same<bool, TypeT>::value,
bool>
::type
495 inline get(
const label i)
const
497 return (i >= 0 && i < size_ && v_[i]);
503 template<
class TypeT = T>
504 typename std::enable_if<std::is_same<bool, TypeT>::value,
bool>
::type
505 inline unset(
const label i)
507 if (i >= 0 && i < size_ && v_[i])
521 template<
class HashT=Foam::Hash<T>>
524 inline unsigned operator()
532 return Hasher(obj.cdata(), obj.size()*
sizeof(
T), seed);
535 for (
const T& val : obj)
537 seed = HashT()(val, seed);
557 Ostream&
operator<<(Ostream& os,
const std::vector<T>& list);
563 void sort(UList<T>& a);
565 template<
class T,
class Compare>
566 void sort(UList<T>& a,
const Compare& comp);
571 template<
class T,
class Compare>
572 void stableSort(UList<T>& a,
const Compare& comp);
579 inline void reverse(UList<T>& list,
const label
n);
583 inline void reverse(UList<T>& list);
587 inline void Swap(UList<T>& a, UList<T>&
b);
601 for (
const T& val : obj)
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
const_iterator cbegin() const
Return const_iterator to begin traversing the constant UList.
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type test(const label i) const
A bitSet::test() method for a list of bool.
void reverse(UList< T > &list, const label n)
bool operator<(const UList< T > &list) const
Compare two ULists lexicographically. Takes linear time.
less(const UList< T > &list)
A class for handling words, derived from Foam::string.
labelRange validateRange(const labelRange &range) const
const_iterator cend() const
Return const_iterator to end traversing the constant UList.
T & first()
Return the first element of the list.
const typedef T & const_reference
The type used for reading from constant value_type objects.
bool operator>=(const UList< T > &a) const
Return true if !(a < b). Takes linear time.
constexpr UList() noexcept
Default construct, zero-sized and nullptr.
unsigned Hasher(const void *data, size_t len, unsigned seed=0)
Bob Jenkins's 96-bit mixer hashing function (lookup3)
bool operator==(const UList< T > &a) const
Equality operation on ULists of the same type.
A List obtained as a section of another List.
bool operator<=(const UList< T > &a) const
Return true if !(a > b). Takes linear time.
void checkSize(const label size) const
Check size is within valid range [0,size].
unsigned operator()(const T &obj, unsigned seed=0) const
Istream & operator>>(Istream &, directionInfo &)
label size_type
The type to represent the size of a UList.
void deepCopy(const UList< T > &list)
Copy elements of the given UList.
void Swap(DynamicList< T, SizeMin1 > &a, DynamicList< T, SizeMin2 > &b)
label rcIndex(const label i) const
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)
Swap arguments as per std::swap, but in Foam namespace.
label rfind(const T &val, label pos=-1) const
Find index of the last occurrence of the value.
void checkStart(const label start) const
Check start is within valid range [0,size)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
const UList< T > & values
Hash function class. The default definition is for primitives, non-primitives used to hash entries on...
label operator()(const T &obj) const
A list compare binary predicate for reverse sort.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
unsigned operator()(const UList< T > &obj, unsigned seed=0) const
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
T * iterator
Random access iterator for traversing a UList.
T & last()
Return the last element of the list.
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.
T & reference
The type used for storing into value_type objects.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Number of items before requiring line-breaks in the list output.
static constexpr label max_size() noexcept
The size of the largest possible UList.
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.
A list compare binary predicate for normal sort.
const_reverse_iterator crend() const
Return const_reverse_iterator to end reverse traversing the UList.
bool operator()(const T &obj) const
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
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)
void writeEntry(Ostream &os) const
Write the UList with its compound type.
UList< char > charUList
A UList of chars.
Extract size (as label) from an object, typically using its size() method.
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type unset(const label i)
A bitSet::unset() method for a list of bool.
void shallowCopy(const UList< T > &list)
Copy the pointer held by the given UList.
bool operator>(const UList< T > &a) const
Compare two ULists lexicographically. Takes linear time.
Test if object is empty, typically using its empty() method.
void swap(UList< T > &list)
Swap content with another UList of the same type in constant time.
UList< bool > boolUList
A UList of bools.
bool operator()(const label a, const label b) const
label difference_type
The difference between iterator objects.
label fcIndex(const label i) const
void shuffle(UList< T > &a)
reverse_iterator rbegin()
Return reverse_iterator to begin reverse traversing the UList.
const UList< T > & values
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
UList< T > & operator=(const UList< T > &)=delete
No copy assignment (default: shallow copy)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Hashing function class for 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.
const typedef T * const_pointer
The pointer type for const access to value_type items.
std::streamsize byteSize() const
const T * cdata() const
Return a const pointer to the first data element.
const typedef T * const_iterator
Random access iterator for traversing a UList.
bool operator()(const label a, const label b) const
void size(const label n) noexcept
Override size to be inconsistent with allocated storage.
bool found(const T &val, label pos=0) const
True if the value if found in the list.
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type get(const label i) const
A bitSet::get() method for a list of bool.
std::reverse_iterator< const_iterator > const_reverse_iterator
Reverse iterator (const access)
T * pointer
The pointer type for non-const access to value_type items.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
UList< label > labelUList
A UList of labels.
iterator end()
Return an iterator to end traversing the UList.
void moveLast(const label i)
Move element to the last position.
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
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)
T value_type
The value type the list contains.
Database for solution data, solver performance and other reduced data.
greater(const UList< T > &list)
Forward definition for Hash function class and the definition for the Hasher function.
A template class to specify that a data type can be considered as being contiguous in memory.
const T & rcValue(const label i) const
Return reverse circular value (ie, previous value in the list)
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
const_reverse_iterator crbegin() const
Return const_reverse_iterator to begin reverse traversing the UList.
dimensionedScalar pos(const dimensionedScalar &ds)
const T & operator()(const T &obj) const