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>
142 checkSize(list.size());
144 auto iter = list.
begin();
145 for (
unsigned i=0; i<
N; ++i)
153 template<
class T,
unsigned N>
163 template<
class T,
unsigned N>
171 template<
class T,
unsigned N>
179 template<
class T,
unsigned N>
186 template<
class T,
unsigned N>
193 template<
class T,
unsigned N>
200 template<
class T,
unsigned N>
207 template<
class T,
unsigned N>
210 return (i ==
N-1 ? 0 : i+1);
214 template<
class T,
unsigned N>
217 return this->operator[](this->fcIndex(i));
221 template<
class T,
unsigned N>
224 return this->operator[](this->fcIndex(i));
228 template<
class T,
unsigned N>
231 return (i ? i-1 :
N-1);
235 template<
class T,
unsigned N>
238 return this->operator[](this->rcIndex(i));
242 template<
class T,
unsigned N>
245 return this->operator[](this->rcIndex(i));
249 template<
class T,
unsigned N>
256 <<
"start " <<
start <<
" out of range [0," <<
N <<
")"
262 template<
class T,
unsigned N>
265 if (
unsigned(size) !=
N)
268 <<
"size " << size <<
" != " <<
N
274 template<
class T,
unsigned N>
277 if (i < 0 ||
unsigned(i) >=
N)
280 <<
"index " << i <<
" out of range [0," <<
N <<
")"
286 template<
class T,
unsigned N>
289 if (empty())
return false;
291 for (
unsigned i=1; i<
N; ++i)
303 template<
class T,
unsigned N>
314 template<
class T,
unsigned N>
322 template<
class T,
unsigned N>
331 template<
class T,
unsigned N>
339 for (
unsigned i=0; i<
N; ++i)
346 template<
class T,
unsigned N>
354 for (
unsigned i=0; i<
N; ++i)
356 v_[i] = std::move(list[i]);
363 template<
class T,
unsigned N>
373 template<
class T,
unsigned N>
383 template<
class T,
unsigned N>
386 for (
unsigned i=0; i<
N; ++i)
392 template<
class T,
unsigned N>
395 checkSize(list.
size());
397 for (
unsigned i=0; i<
N; ++i)
403 template<
class T,
unsigned N>
406 checkSize(list.size());
408 auto iter = list.
begin();
409 for (
unsigned i=0; i<
N; ++i)
416 template<
class T,
unsigned N>
419 checkSize(list.size());
421 auto iter = list.begin();
422 for (
unsigned i=0; i<
N; ++i)
429 template<
class T,
unsigned N>
432 for (
unsigned i=0; i<
N; ++i)
438 template<
class T,
unsigned N>
446 for (
unsigned i=0; i<
N; ++i)
452 template<
class T,
unsigned N>
462 for (
unsigned i=0; i<
N; ++i)
464 v_[i] = std::move(list.v_[i]);
471 template<
class T,
unsigned N>
479 template<
class T,
unsigned N>
487 template<
class T,
unsigned N>
495 template<
class T,
unsigned N>
503 template<
class T,
unsigned N>
511 template<
class T,
unsigned N>
519 template<
class T,
unsigned N>
527 template<
class T,
unsigned N>
535 template<
class T,
unsigned N>
543 template<
class T,
unsigned N>
551 template<
class T,
unsigned N>
559 template<
class T,
unsigned N>
569 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
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.
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.
bool found(const T &val, const label start=0) const
True if the value if found in the list. Linear search.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
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.
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.
void size(const label n) noexcept
Override size to be inconsistent with allocated storage.
const Vector< label > N(dict.get< Vector< label >>("N"))
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), which can be used to avoid manipulating objects that ar...