67template<
class T>
class List;
69template<
class T>
class UList;
84template<
class E>
class ListExpression;
85template<
class T>
class ListConstRefWrap;
201 bool operator()(
const label a,
const label
b)
const
217 bool operator()(
const label a,
const label
b)
const
269 inline const
T&
fcValue(const label i) const;
300 inline const
T&
front() const;
306 inline const
T&
back() const;
320 inline
void checkStart(const label start) const;
326 inline
void checkRange(const label start, const label len) const;
338 inline
bool contains(const
T& val) const;
345 inline
bool contains(const
T& val, label
pos, label len = -1) const;
350 label
find(const
T& val) const;
357 label
find(const
T& val, label
pos, label len = -1) const;
363 label
rfind(const
T& val, label
pos = -1) const;
422 inline
T& operator[](const label i);
427 inline const
T& operator[](const label i) const;
435 return *
reinterpret_cast<const List<T>*
>(
this);
577 class = std::enable_if_t<stdFoam::is_bool_v<TypeT>>
579 inline bool all()
const
589 class = std::enable_if_t<stdFoam::is_bool_v<TypeT>>
591 inline bool any()
const
601 class = std::enable_if_t<stdFoam::is_bool_v<TypeT>>
614 class = std::enable_if_t<stdFoam::is_bool_v<TypeT>>
616 inline bool test(
const label i)
const
618 return (i >= 0 && i < size_ && v_[i]);
627 class = std::enable_if_t<stdFoam::is_bool_v<TypeT>>
629 inline bool get(
const label i)
const
631 return (i >= 0 && i < size_ && v_[i]);
641 class = std::enable_if_t<stdFoam::is_bool_v<TypeT>>
643 inline bool unset(
const label i)
645 if (i >= 0 && i < size_ && v_[i])
657 class = std::enable_if_t<stdFoam::is_char_v<TypeT>>
659 inline std::string_view
view()
const
661 return std::string_view(v_, size_);
670 inline unsigned operator()
683 for (
const T& val : obj)
685 seed = op(val, seed);
694 template<
class Unused=
bool>
695 struct Hash :
UList<T>::hasher
717 const T&
last()
const {
return back(); };
720 bool found(
const T& val, label
pos = 0)
const
785template<
class T,
class Compare>
793template<
class T,
class Compare>
829 bool operator()(
const T& obj)
const {
return obj.empty(); }
837 label
operator()(
const T& obj)
const {
return obj.size(); }
Implementation of IO operators for Foam::IntRange.
Expression wrap of const reference to UList.
Expression templates for List.
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
A List with indirect addressing.
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 non-owning sub-view of a List (allocated or unallocated storage).
A List with indirect addressing. Like IndirectList but does not store addressing.
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)
void operator=(Foam::zero)
Assignment of all entries to zero.
void swapLast(const label i)
void shallowCopy(bool *__restrict__ ptr, const label len) noexcept
const_reverse_iterator crbegin() const
bool any() const
True if any entries are 'true'.
void fill_uniform(const T &val)
Assign all entries to the given value.
T & first()
Access first element of the list, position [0].
bool found(const T &val, label pos=0) const
Same as contains().
iterator begin() noexcept
Return an iterator to begin traversing the UList.
bool test(const label i) const
Test bool value at specified position, always false for out-of-range access.
char * data_bytes() noexcept
const_reverse_iterator crend() const
bool operator<(const UList< T > &list) const
Compare two ULists lexicographically. Takes linear time.
const bool * const_iterator
void checkIndex(const label i) const
bool none() const
True if no entries are 'true'.
void swapFirst(const label i)
auto expr() const
Wrap value as expression.
void deepCopy(const UList< bool > &list)
UList(const UList< T > &) noexcept=default
Copy construct, shallow copy.
void operator=(const T &val)
Assignment of all entries to the given value.
bool empty() const noexcept
std::reverse_iterator< const_iterator > const_reverse_iterator
bool contains(const bool &val) const
const bool & rcValue(const label i) const
const_iterator cend() const noexcept
void fill_uniform(Foam::zero)
Assign all entries to zero.
std::string_view view() const
Return a string_view of the charList. Content is non-modifiable.
const bool * cdata() const noexcept
const bool * const_pointer
label rfind(const bool &val, label pos=-1) const
bool all() const
True if all entries are 'true' or if the list is empty.
constexpr UList() noexcept
Default construct, zero-sized and nullptr.
reverse_iterator rbegin()
void writeEntry(const word &keyword, Ostream &os) const
Write the List as a dictionary entry with keyword.
void swap(UList< T > &list) noexcept
Swap content with another UList of the same type in constant time.
const T & last() const
Access last element of the list, position [size()-1].
static constexpr label max_size() noexcept
The size of the largest possible UList.
const_iterator cbegin() const noexcept
const bool & fcValue(const label i) const
bool operator>=(const UList< T > &list) const
Return true if !(a < b). Takes linear time.
void operator=(const Expression::ListExpression< E > &expr)
Assign values from expression.
UList(UList< T > &&) noexcept=default
Move construct, shallow copy.
SubList< bool > slice(const label pos, label len=-1)
label rcIndex(const label i) const noexcept
std::reverse_iterator< iterator > reverse_iterator
bool operator!=(const UList< T > &list) const
The opposite of the equality operation. Takes linear time.
const T & first() const
Access first element of the list.
std::streamsize byteSize() const
bool unset(const label i)
Unset the bool entry at specified position, always false for out-of-range access.
label capacity() const noexcept
Size of the underlying storage.
void checkSize(const label size) const
const char * cdata_bytes() const noexcept
void writeEntry(Ostream &os) const
Write the UList with its compound type.
static const UList< T > & null() noexcept
Return a null UList (reference to a nullObject). Behaves like an empty UList.
bool get(const label i) const
Return bool value at specified position, always false for out-of-range access.
label size() const noexcept
The number of elements in the container.
bool operator>(const UList< T > &list) const
Compare two ULists lexicographically. Takes linear time.
void moveFirst(const label i)
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
bool operator==(const UList< T > &list) const
Equality operation on ULists of the same type.
Istream & readList(Istream &is)
Read List contents from Istream.
std::streamsize size_bytes() const noexcept
void checkRange(const label start, const label len) const
void setAddressableSize(const label n) noexcept
Set addressed size to be inconsistent with allocated storage.
labelRange validateRange(const labelRange &requestedRange) const
Return a validated (start,size) subset range, which means that it always addresses a valid section of...
T & last()
Access last element of the list, position [size()-1].
bool operator<=(const UList< T > &list) const
Return true if !(a > b). Takes linear time.
UList< T > & operator=(const UList< T > &)=delete
No copy assignment (default: shallow copy).
label find(const bool &val) const
const bool & const_reference
label fcIndex(const label i) const noexcept
void checkStart(const label start) const
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)
A namespace for expression templates.
dimensionedScalar pos(const dimensionedScalar &ds)
void shuffle(UList< T > &list)
Randomise the list order.
const T & NullObjectRef() noexcept
Const reference (of type T) to the nullObject.
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.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
Istream & operator>>(Istream &, directionInfo &)
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
void sort(UList< T > &list)
Sort the list.
UList< bool > boolUList
A UList of bools.
constexpr bool is_contiguous_v
The is_contiguous value of Type (after stripping of qualifiers).
UList< label > labelUList
A UList of labels.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
void stableSort(UList< T > &list)
Stable sort the list.
Includes some common C++ headers, defines global macros and templates used in multiple places by Open...
#define FOAM_DEPRECATED_FOR(since, replacement)
#define FOAM_DEPRECATED_STRICTER(since, replacement)
Hash function class. The default definition is for primitives. Non-primitives used to hash entries on...
Number of items before requiring line-breaks in the list output.
Deprecated(2021-04) hashing functor. Use hasher().
FOAM_DEPRECATED_FOR(2021-04, "hasher()") Hash()
bool operator()(const label a, const label b) const
const UList< T > & values
greater(const UList< T > &list)
Hashing functor for UList.
bool operator()(const label a, const label b) const
const UList< T > & values
less(const UList< T > &list)
Object access operator or list access operator (default is pass-through).
const T & operator()(const T &obj) const
Test if object is empty, typically using its empty() method.
bool operator()(const T &obj) const
Extract size (as label) from an object, typically using its size() method.
label operator()(const T &obj) const