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>
52 template<
class T,
unsigned N>
59 template<
class T,
unsigned N>
62 for (
unsigned i=0; i<
N; ++i)
69 template<
class T,
unsigned N>
72 for (
unsigned i=0; i<
N; ++i)
79 template<
class T,
unsigned N>
82 for (
unsigned i=0; i<
N; ++i)
84 v_[i] = std::move(list.v_[i]);
89 template<
class T,
unsigned N>
90 template<
class InputIterator>
93 InputIterator begIter,
99 for (
unsigned i=0; i<
N; ++i)
107 template<
class T,
unsigned N>
110 checkSize(list.size());
112 auto iter = list.begin();
113 for (
unsigned i=0; i<
N; ++i)
121 template<
class T,
unsigned N>
124 checkSize(list.
size());
126 for (
unsigned i=0; i<
N; ++i)
133 template<
class T,
unsigned N>
140 for (
unsigned i=0; i<
N; ++i)
142 v_[i] = list[indices[i]];
147 template<
class T,
unsigned N>
150 checkSize(list.size());
152 auto iter = list.
begin();
153 for (
unsigned i=0; i<
N; ++i)
161 template<
class T,
unsigned N>
171 template<
class T,
unsigned N>
179 template<
class T,
unsigned N>
187 template<
class T,
unsigned N>
194 template<
class T,
unsigned N>
201 template<
class T,
unsigned N>
208 template<
class T,
unsigned N>
215 template<
class T,
unsigned N>
218 return (i ==
N-1 ? 0 : i+1);
222 template<
class T,
unsigned N>
225 return this->operator[](this->fcIndex(i));
229 template<
class T,
unsigned N>
232 return this->operator[](this->fcIndex(i));
236 template<
class T,
unsigned N>
239 return (i ? i-1 :
N-1);
243 template<
class T,
unsigned N>
246 return this->operator[](this->rcIndex(i));
250 template<
class T,
unsigned N>
253 return this->operator[](this->rcIndex(i));
257 template<
class T,
unsigned N>
260 if (start < 0 || (start &&
unsigned(start) >=
N))
264 <<
"start " << start <<
" out of range [0," <<
N <<
")"
270 template<
class T,
unsigned N>
273 if (
unsigned(size) !=
N)
276 <<
"size " << size <<
" != " <<
N
282 template<
class T,
unsigned N>
285 if (i < 0 ||
unsigned(i) >=
N)
288 <<
"index " << i <<
" out of range [0," <<
N <<
")"
294 template<
class T,
unsigned N>
297 if (empty())
return false;
299 for (
unsigned i=1; i<
N; ++i)
311 template<
class T,
unsigned N>
318 return (this->
find(val,
pos) >= 0);
322 template<
class T,
unsigned N>
330 template<
class T,
unsigned N>
339 template<
class T,
unsigned N>
342 for (
unsigned i=0; i<
N; ++i)
349 template<
class T,
unsigned N>
352 for (
unsigned i=0; i<
N; ++i)
359 template<
class T,
unsigned N>
367 for (
unsigned i=0; i<
N; ++i)
374 template<
class T,
unsigned N>
382 for (
unsigned i=0; i<
N; ++i)
384 v_[i] = std::move(list[i]);
391 template<
class T,
unsigned N>
401 template<
class T,
unsigned N>
411 template<
class T,
unsigned N>
414 for (
unsigned i=0; i<
N; ++i)
420 template<
class T,
unsigned N>
423 checkSize(list.
size());
425 for (
unsigned i=0; i<
N; ++i)
431 template<
class T,
unsigned N>
434 checkSize(list.size());
436 auto iter = list.
begin();
437 for (
unsigned i=0; i<
N; ++i)
444 template<
class T,
unsigned N>
447 checkSize(list.size());
449 auto iter = list.begin();
450 for (
unsigned i=0; i<
N; ++i)
457 template<
class T,
unsigned N>
464 template<
class T,
unsigned N>
471 template<
class T,
unsigned N>
479 for (
unsigned i=0; i<
N; ++i)
485 template<
class T,
unsigned N>
495 for (
unsigned i=0; i<
N; ++i)
497 v_[i] = std::move(list.v_[i]);
504 template<
class T,
unsigned N>
512 template<
class T,
unsigned N>
520 template<
class T,
unsigned N>
528 template<
class T,
unsigned N>
536 template<
class T,
unsigned N>
544 template<
class T,
unsigned N>
552 template<
class T,
unsigned N>
560 template<
class T,
unsigned N>
568 template<
class T,
unsigned N>
576 template<
class T,
unsigned N>
584 template<
class T,
unsigned N>
592 template<
class T,
unsigned N>
602 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 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 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 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)