59#include <initializer_list>
74template<
class T>
class List;
75template<
class T>
class SubList;
76template<
class T>
class UList;
77template<
class T>
class IndirectList;
78template<
class T,
class Addr>
class IndirectListBase;
80template<
class T> Istream&
operator>>(Istream&, UList<T>&);
81template<
class T> Ostream&
operator<<(Ostream&,
const UList<T>&);
173 friend class List<
T>;
197 bool operator()(
const label a,
const label
b)
const
213 bool operator()(
const label a,
const label
b)
const
248 inline const
T&
fcValue(const label i) const;
254 inline const
T&
rcValue(const label i) const;
279 inline const
T&
first() const;
285 inline const
T&
last() const;
299 inline
void checkStart(const label start) const;
305 inline
void checkRange(const label start, const label len) const;
320 label
find(const
T& val, label
pos = 0) const;
326 label
rfind(const
T& val, label
pos = -1) const;
332 inline
bool found(const
T& val, label
pos = 0) const;
385 inline
T& operator[](const label i);
390 inline const
T& operator[](const label i) const;
393 inline operator const
Foam::
List<
T>&() const;
396 void operator=(const
T& val);
517 template<
class TypeT = T>
518 typename std::enable_if<std::is_same<bool, TypeT>::value,
bool>
::type
519 inline test(
const label i)
const
521 return (i >= 0 && i < size_ && v_[i]);
527 template<
class TypeT = T>
528 typename std::enable_if<std::is_same<bool, TypeT>::value,
bool>
::type
529 inline get(
const label i)
const
531 return (i >= 0 && i < size_ && v_[i]);
538 template<
class TypeT = T>
539 typename std::enable_if<std::is_same<bool, TypeT>::value,
bool>
::type
540 inline unset(
const label i)
542 if (i >= 0 && i < size_ && v_[i])
556 inline unsigned operator()
564 return Foam::Hasher(obj.cdata(), obj.size_bytes(), seed);
568 for (
const T& val : obj)
570 seed = op(val, seed);
578 template<
class Unused=
bool>
634template<
class T,
class Compare>
642template<
class T,
class Compare>
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A List obtained as a section of another 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.
label size_type
The type to represent the size of a UList.
bool operator!=(const UList< T > &a) const
The opposite of the equality operation. Takes linear time.
void swapLast(const label i)
Swap element with the last element. Fatal on an empty list.
bool operator==(const UList< T > &a) const
Equality operation on ULists of the same type.
const_reverse_iterator crbegin() const
Return const_reverse_iterator to begin reverse traversing the UList.
label difference_type
The difference between iterator objects.
T & first()
Return the first element of the list.
iterator begin() noexcept
Return an iterator to begin traversing the UList.
void swap(UList< T > &list)
Swap content with another UList of the same type in constant time.
char * data_bytes() noexcept
Return pointer to the underlying array serving as data storage,.
T value_type
The value type the list contains.
const_reverse_iterator crend() const
Return const_reverse_iterator to end reverse traversing the UList.
bool operator<(const UList< T > &list) const
Compare two ULists lexicographically. Takes linear time.
static const UList< T > & null()
Return a UList reference to a nullObject.
const T * const_iterator
Random access iterator for traversing a UList.
void checkIndex(const label i) const
Check index is within valid range [0,size)
void swapFirst(const label i)
Swap element with the first element. Fatal on an empty list.
T * iterator
Random access iterator for traversing a UList.
void deepCopy(const UList< T > &list)
Copy elements of the given UList. Sizes must match!
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
std::reverse_iterator< const_iterator > const_reverse_iterator
Reverse iterator (const access)
const T & rcValue(const label i) const
Return reverse circular value (ie, previous value in the list)
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.
const_iterator cend() const noexcept
Return const_iterator to end traversing the constant UList.
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type get(const label i) const
const T * cdata() const noexcept
Return pointer to the underlying array serving as data storage.
const T * const_pointer
The pointer type for const access to value_type items.
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type test(const label i) const
T * pointer
The pointer type for non-const access to value_type items.
label rfind(const T &val, label pos=-1) const
Find index of the last occurrence of the value.
constexpr UList() noexcept
Default construct, zero-sized and nullptr.
reverse_iterator rbegin()
Return reverse_iterator to begin reverse traversing the UList.
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type unset(const label i)
static constexpr label max_size() noexcept
The size of the largest possible UList.
const_iterator cbegin() const noexcept
Return const_iterator to begin traversing the constant UList.
const T & fcValue(const label i) const
Return forward circular value (ie, next value in the list)
bool operator>=(const UList< T > &a) const
Return true if !(a < b). Takes linear time.
SubList< T > slice(const label pos, label len=-1)
Return SubList slice (non-const access) - no range checking.
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
label rcIndex(const label i) const noexcept
std::reverse_iterator< iterator > reverse_iterator
Reverse iterator (non-const access)
T & reference
The type used for storing into value_type objects.
std::streamsize byteSize() const
void checkSize(const label size) const
Check size is within valid range [0,size].
const char * cdata_bytes() const noexcept
Return pointer to the underlying array serving as data storage,.
void writeEntry(Ostream &os) const
Write the UList with its compound type.
reverse_iterator rend()
Return reverse_iterator to end reverse traversing the UList.
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.
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
Istream & readList(Istream &is)
Read List contents from Istream.
std::streamsize size_bytes() const noexcept
Number of contiguous bytes for the List data.
UList(const UList< T > &)=default
Copy construct.
void checkRange(const label start, const label len) const
Check that start and length define a valid range.
void setAddressableSize(const label n) noexcept
Set addressed size to be inconsistent with allocated storage.
void shallowCopy(const UList< T > &list)
Copy the pointer and size held by the given UList.
labelRange validateRange(const labelRange &requestedRange) const
T & last()
Return the last element of the list.
UList< T > & operator=(const UList< T > &)=delete
No copy assignment (default: shallow copy)
const T & const_reference
The type used for reading from constant value_type objects.
label fcIndex(const label i) const noexcept
void checkStart(const label start) const
Check start is within valid range [0,size)
Database for solution data, solver performance and other reduced data.
A range or interval of labels defined by a start and a size.
A class for handling words, derived from Foam::string.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
OBJstream os(runTime.globalPath()/outputName)
dimensionedScalar pos(const dimensionedScalar &ds)
void shuffle(UList< T > &list)
Randomise the list order.
void reverse(UList< T > &list, const label n)
Reverse the first n elements of the list.
unsigned Hasher(const void *data, size_t len, unsigned seed=0)
Bob Jenkins's 96-bit mixer hashing function (lookup3)
UList< char > charUList
A UList of chars.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
Istream & operator>>(Istream &, directionInfo &)
void sort(UList< T > &list)
Sort the list.
UList< bool > boolUList
A UList of bools.
UList< label > labelUList
A UList of labels.
void stableSort(UList< T > &list)
Stable sort the list.
Includes some standard C++ headers, defines global macros and templates used in multiple places by Op...
#define FOAM_DEPRECATED_FOR(since, replacement)
Number of items before requiring line-breaks in the list output.
Hash function class. The default definition is for primitives. Non-primitives used to hash entries on...
Deprecated(2021-04) hashing functor. Use hasher()
FOAM_DEPRECATED_FOR(2021-04, "hasher()") Hash()
A list compare binary predicate for reverse sort.
bool operator()(const label a, const label b) const
const UList< T > & values
greater(const UList< T > &list)
Hashing functor for UList.
A list compare binary predicate for normal sort.
bool operator()(const label a, const label b) const
const UList< T > & values
less(const UList< T > &list)
const T & operator()(const T &obj) const
Test if object is empty, typically using its empty() method.
bool operator()(const T &obj) const
A template class to specify that a data type can be considered as being contiguous in memory.
Extract size (as label) from an object, typically using its size() method.
label operator()(const T &obj) const