Go to the documentation of this file.
31 #include <type_traits>
36 template<
class T,
unsigned N>
39 return NullObjectRef<FixedList<T, N>>();
45 template<
class T,
unsigned N>
48 for (
unsigned i=0; i<
N; ++i)
55 template<
class T,
unsigned N>
58 for (
unsigned i=0; i<
N; ++i)
65 template<
class T,
unsigned N>
68 for (
unsigned i=0; i<
N; ++i)
75 template<
class T,
unsigned N>
78 for (
unsigned i=0; i<
N; ++i)
85 template<
class T,
unsigned N>
88 for (
unsigned i=0; i<
N; ++i)
90 v_[i] = std::move(list.v_[i]);
95 template<
class T,
unsigned N>
96 template<
class InputIterator>
99 InputIterator begIter,
100 InputIterator endIter
105 for (
unsigned i=0; i<
N; ++i)
113 template<
class T,
unsigned N>
116 checkSize(list.size());
118 auto iter = list.begin();
119 for (
unsigned i=0; i<
N; ++i)
127 template<
class T,
unsigned N>
130 checkSize(list.
size());
132 for (
unsigned i=0; i<
N; ++i)
139 template<
class T,
unsigned N>
146 for (
unsigned i=0; i<
N; ++i)
148 v_[i] = list[indices[i]];
153 template<
class T,
unsigned N>
156 checkSize(list.size());
158 auto iter = list.
begin();
159 for (
unsigned i=0; i<
N; ++i)
167 template<
class T,
unsigned N>
177 template<
class T,
unsigned N>
185 template<
class T,
unsigned N>
193 template<
class T,
unsigned N>
200 template<
class T,
unsigned N>
207 template<
class T,
unsigned N>
214 template<
class T,
unsigned N>
221 template<
class T,
unsigned N>
224 return (i ==
N-1 ? 0 : i+1);
228 template<
class T,
unsigned N>
231 return this->operator[](this->fcIndex(i));
235 template<
class T,
unsigned N>
238 return this->operator[](this->fcIndex(i));
242 template<
class T,
unsigned N>
245 return (i ? i-1 :
N-1);
249 template<
class T,
unsigned N>
252 return this->operator[](this->rcIndex(i));
256 template<
class T,
unsigned N>
259 return this->operator[](this->rcIndex(i));
263 template<
class T,
unsigned N>
266 if (start < 0 || (start &&
unsigned(start) >=
N))
270 <<
"start " << start <<
" out of range [0," <<
N <<
")"
276 template<
class T,
unsigned N>
279 if (
unsigned(size) !=
N)
282 <<
"size " << size <<
" != " <<
N
288 template<
class T,
unsigned N>
291 if (i < 0 ||
unsigned(i) >=
N)
294 <<
"index " << i <<
" out of range [0," <<
N <<
")"
300 template<
class T,
unsigned N>
303 if (empty())
return false;
305 for (
unsigned i=1; i<
N; ++i)
317 template<
class T,
unsigned N>
324 return (this->
find(val,
pos) >= 0);
328 template<
class T,
unsigned N>
336 template<
class T,
unsigned N>
345 template<
class T,
unsigned N>
353 for (
unsigned i=0; i<
N; ++i)
360 template<
class T,
unsigned N>
368 for (
unsigned i=0; i<
N; ++i)
370 v_[i] = std::move(list[i]);
377 template<
class T,
unsigned N>
387 template<
class T,
unsigned N>
397 template<
class T,
unsigned N>
400 for (
unsigned i=0; i<
N; ++i)
406 template<
class T,
unsigned N>
409 checkSize(list.
size());
411 for (
unsigned i=0; i<
N; ++i)
417 template<
class T,
unsigned N>
420 checkSize(list.size());
422 auto iter = list.
begin();
423 for (
unsigned i=0; i<
N; ++i)
430 template<
class T,
unsigned N>
433 checkSize(list.size());
435 auto iter = list.begin();
436 for (
unsigned i=0; i<
N; ++i)
443 template<
class T,
unsigned N>
446 for (
unsigned i=0; i<
N; ++i)
452 template<
class T,
unsigned N>
460 for (
unsigned i=0; i<
N; ++i)
466 template<
class T,
unsigned N>
476 for (
unsigned i=0; i<
N; ++i)
478 v_[i] = std::move(list.v_[i]);
485 template<
class T,
unsigned N>
493 template<
class T,
unsigned N>
501 template<
class T,
unsigned N>
509 template<
class T,
unsigned N>
517 template<
class T,
unsigned N>
525 template<
class T,
unsigned N>
533 template<
class T,
unsigned N>
541 template<
class T,
unsigned N>
549 template<
class T,
unsigned N>
557 template<
class T,
unsigned N>
565 template<
class T,
unsigned N>
573 template<
class T,
unsigned N>
583 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.
static const FixedList< T, N > & null()
Return a null FixedList.
constexpr auto begin(C &c) -> decltype(c.begin())
Return iterator to the beginning of the container c.
iterator begin()
Return an iterator to begin traversing the FixedList.
T * data() noexcept
Return a pointer to the first data element.
const_reverse_iterator crbegin() const
Return const_reverse_iterator to begin reverse traversing FixedList.
static constexpr const zero Zero
Global zero (0)
void checkIndex(const label i) const
Check index is within valid range [0,N)
void transfer(FixedList< T, N > &list)
T & last() noexcept
The last element of the list, position [N-1].
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)
void operator=(const T list[N])
Assignment to array operator. 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 fcIndex(const label i) const
T & first() noexcept
The first element of the list, position [0].
Template class for non-intrusive linked lists.
T * iterator
Random access iterator for traversing FixedList.
iterator begin()
Iterator to first item in list with non-const access.
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_reverse_iterator crend() const
Return const_reverse_iterator to end reverse traversing FixedList.
reverse_iterator rend()
Return reverse_iterator to end reverse traversing the FixedList.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
label find(const ListType &input, const UnaryPredicate &pred, const label start=0)
Find index of the first occurrence that satisfies the predicate.
void setSize(const label n)
Dummy setSize function, to make FixedList consistent with List.
errorManip< error > abort(error &err)
T & operator[](const label i)
Return element of FixedList.
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.
scalar distance(const vector &p1, const vector &p2)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Non-intrusive singly-linked list.
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.
void size(const label n) noexcept
Override size to be inconsistent with allocated storage.
const Vector< label > N(dict.get< Vector< label >>("N"))
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
reverse_iterator rbegin()
Return reverse_iterator to begin reverse traversing the FixedList.
void swap(FixedList< T, N > &list)
Swap lists by swapping the content of the individual list elements.
bool uniform() const
True if all entries have identical values, and list is non-empty.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
dimensionedScalar pos(const dimensionedScalar &ds)