Go to the documentation of this file.
54 #include <initializer_list>
56 #include <type_traits>
66 template<
class T,
unsigned N>
class FixedList;
67 template<
class T>
class UList;
69 template<
class T,
unsigned N>
70 Istream&
operator>>(Istream& is, FixedList<T, N>& list);
77 template<
class T,
unsigned N>
83 "Size must be positive (non-zero) and fit as a signed int value"
167 template<
class InputIterator>
168 inline FixedList(InputIterator begIter, InputIterator endIter);
171 inline FixedList(std::initializer_list<T> list);
193 inline const T*
cdata() const noexcept;
198 inline
T*
data() noexcept;
201 inline
T&
first() noexcept;
204 inline const
T&
first() const noexcept;
207 inline
T&
last() noexcept;
210 inline const
T&
last() const noexcept;
288 inline
T& operator[](const
label i);
291 inline const
T& operator[](const
label i) const;
294 inline
void operator=(const
T list[
N]);
297 inline
void operator=(const
UList<
T>& list);
300 inline
void operator=(const
SLList<
T>& list);
303 inline
void operator=(std::initializer_list<
T> list);
306 inline
void operator=(const
T&
val);
309 inline
void operator=(const
FixedList<
T,
N>& list);
366 static constexpr
bool empty() noexcept {
return !
N; }
369 static constexpr
label size() noexcept {
return N; }
372 static constexpr
unsigned max_size() noexcept {
return N; }
426 template<
class HashT=Foam::Hash<T>>
429 inline unsigned operator()
437 return Hasher(obj.cdata(),
N*
sizeof(
T), seed);
440 for (
const T&
val : obj)
442 seed = HashT()(
val, seed);
452 template<
class T,
unsigned N>
456 template<
class T,
unsigned N>
460 template<
class T,
unsigned N>
468 template<
class T,
unsigned N>
474 template<
class T,
unsigned N>
477 inline unsigned operator()
485 return Hasher(obj.cdata(),
N*
sizeof(
T), seed);
488 for (
const T&
val : obj)
501 template<
class T,
unsigned N>
const T & fcValue(const label i) const
Return forward circular value (ie, next value in the list)
autoPtr< FixedList< T, N > > clone() const
Clone.
label ListType::const_reference val
A class for handling words, derived from Foam::string.
void writeEntry(Ostream &os) const
Write the FixedList with its compound type.
void swapLast(const label i)
Swap element with the last element.
iterator begin()
Return an iterator to begin traversing the FixedList.
const_reverse_iterator crbegin() const
Return const_reverse_iterator to begin reverse traversing FixedList.
void checkIndex(const label i) const
Check index is within valid range [0,N)
unsigned Hasher(const void *data, size_t len, unsigned seed=0)
Bob Jenkins's 96-bit mixer hashing function (lookup3)
void transfer(FixedList< T, N > &list)
T & last() noexcept
The last element of the list, position [N-1].
bool operator<=(const FixedList< T, N > &list) const
Return true if !(a > b). Takes linear time.
const typedef T * const_pointer
The pointer type for const access to value_type items.
static constexpr unsigned max_size() noexcept
The dimensioned size (template parameter N) of the FixedList.
const T * cdata() const noexcept
Return a const pointer to the first data element.
void checkStart(const label start) const
Check start is within valid range [0,size)
T * pointer
The pointer type for non-const access to value_type items.
static constexpr label size() noexcept
Return the number of elements in the FixedList.
label size_type
The type to represent the size of a FixedList.
Istream & operator>>(Istream &, directionInfo &)
bool operator!=(const FixedList< T, N > &list) const
The opposite of the equality operation. Takes linear time.
void resize(const label n)
Dummy resize function, to make FixedList consistent with List.
void Swap(DynamicList< T, SizeMin1 > &a, DynamicList< T, SizeMin2 > &b)
label difference_type
The difference between iterator objects.
label fcIndex(const label i) const
A template class to specify if a data type is composed solely of Foam::label elements.
T & reference
The type used for storing into value_type objects.
Swap arguments as per std::swap, but in Foam namespace.
T & first() noexcept
The first element of the list, position [0].
Template class for non-intrusive linked lists.
bool found(const T &val, const label start=0) const
True if the value if found in the list. Linear search.
Hash function class. The default definition is for primitives, non-primitives used to hash entries on...
bool operator==(const FixedList< T, N > &list) const
Equality operation on FixedLists of the same type.
Forward declarations for SLList.
bool operator<(const FixedList< T, N > &list) const
Compare two FixedLists lexicographically. Takes linear time.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
T * iterator
Random access iterator for traversing FixedList.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Number of items before requiring line-breaks in the list ouput.
const T & rcValue(const label i) const
Return reverse circular value (ie, previous value in the list)
const_iterator cend() const
Return const_iterator to end traversing the constant FixedList.
const typedef T & const_reference
The type used for reading from constant value_type objects.
label find(const T &val, const label start=0) const
Find index of the first occurence of the value.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
const_reverse_iterator crend() const
Return const_reverse_iterator to end reverse traversing FixedList.
void moveFirst(const label i)
Move element to the first position.
T value_type
The value type the FixedList contains.
reverse_iterator rend()
Return reverse_iterator to end reverse traversing the FixedList.
void setSize(const label n)
Dummy setSize function, to make FixedList consistent with List.
A template class to specify if a data type is composed solely of Foam::scalar elements.
std::reverse_iterator< const_iterator > const_reverse_iterator
Reverse iterator (const access)
iterator end()
Return an iterator to end traversing the FixedList.
const_iterator cbegin() const
Return const_iterator to begin traversing the constant FixedList.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
bool operator>(const FixedList< T, N > &list) const
Compare two FixedLists lexicographically. Takes linear time.
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
bool operator>=(const FixedList< T, N > &list) const
Return true if !(a < b). Takes linear time.
Hashing function class for FixedList.
void swapFirst(const label i)
Swap element with the first element.
label ListType::const_reference const label start
A 1D vector of objects of type <T> with a fixed length <N>.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
FixedList()=default
Null constructor.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
const Vector< label > N(dict.get< Vector< label >>("N"))
const typedef T * const_iterator
Random access iterator for traversing FixedList.
static constexpr bool empty() noexcept
Always false since zero-sized FixedList is compile-time disabled.
void checkSize(const label size) const
Check size is identical to template parameter N.
std::reverse_iterator< iterator > reverse_iterator
Reverse iterator (non-const access)
label rcIndex(const label i) const
Database for solution data, solver performance and other reduced data.
Forward definition for Hash function class and the definition for the Hasher function.
Ostream & operator<<(Ostream &, const boundaryPatch &)
reverse_iterator rbegin()
Return reverse_iterator to begin reverse traversing the FixedList.
A template class to specify that a data type can be considered as being contiguous in memory.
void swap(FixedList< T, N > &list)
Swap lists by swapping the content of the individual list elements.
A class representing the concept of 0 (zero), which can be used to avoid manipulating objects that ar...
void moveLast(const label i)
Move element to the last position.