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);
200 inline const T*
cdata() const noexcept;
205 inline
T*
data() noexcept;
208 inline
T&
first() noexcept;
211 inline const
T&
first() const noexcept;
214 inline
T&
last() noexcept;
217 inline const
T&
last() const noexcept;
222 inline label
fcIndex(const label i) const;
225 inline const
T&
fcValue(const label i) const;
232 inline label
rcIndex(const label i) const;
235 inline const
T&
rcValue(const label i) const;
244 inline
void checkStart(const label start) const;
262 label
find(const
T& val, label
pos = 0) const;
268 label
rfind(const
T& val, label
pos = -1) const;
273 inline
bool found(const
T& val, label
pos = 0) const;
279 inline
void resize(const label
n);
285 inline
void fill(const
T& val);
310 inline
T& operator[](const label i);
313 inline const
T& operator[](const label i) const;
316 inline
void operator=(const
T list[
N]);
319 inline
void operator=(const
UList<
T>& list);
322 inline
void operator=(const
SLList<
T>& list);
325 inline
void operator=(std::initializer_list<
T> list);
328 inline
void operator=(const
T& val);
331 inline
void operator=(const
Foam::
zero);
334 inline
void operator=(const
FixedList<
T,
N>& list);
391 static constexpr
bool empty() noexcept {
return !
N; }
394 static constexpr label
size() noexcept {
return N; }
397 static constexpr
unsigned max_size() noexcept {
return N; }
451 template<
class HashT=Foam::Hash<T>>
454 inline unsigned operator()
462 return Hasher(obj.cdata(),
N*
sizeof(
T), seed);
465 for (
const T& val : obj)
467 seed = HashT()(val, seed);
477 template<
class T,
unsigned N>
481 template<
class T,
unsigned N>
485 template<
class T,
unsigned N>
493 template<
class T,
unsigned N>
499 template<
class T,
unsigned N>
502 inline unsigned operator()
510 return Hasher(obj.cdata(),
N*
sizeof(
T), seed);
513 for (
const T& val : obj)
526 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.
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 find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
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 function, to make FixedList consistent with List.
void Swap(DynamicList< T, SizeMin1 > &a, DynamicList< T, SizeMin2 > &b)
void fill(const T &val)
Assign all entries to the given value.
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.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
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.
label rfind(const T &val, label pos=-1) const
Find index of the last occurrence of the value.
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 output.
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 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 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.
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
Default construct.
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.
bool found(const T &val, label pos=0) const
True if the value if found in the list.
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.
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) that can be used to avoid manipulating objects known to ...
void moveLast(const label i)
Move element to the last position.
dimensionedScalar pos(const dimensionedScalar &ds)