34 template<
class T,
unsigned N>
37 return NullObjectRef<FixedList<T, N>>();
43 template<
class T,
unsigned N>
50 template<
class T,
unsigned N>
57 template<
class T,
unsigned N>
60 for (
unsigned i=0; i<
N; ++i)
67 template<
class T,
unsigned N>
70 for (
unsigned i=0; i<
N; ++i)
77 template<
class T,
unsigned N>
80 for (
unsigned i=0; i<
N; ++i)
82 v_[i] = std::move(list.v_[i]);
87 template<
class T,
unsigned N>
90 checkSize(list.size());
92 auto iter = list.begin();
93 for (
unsigned i=0; i<
N; ++i)
101 template<
class T,
unsigned N>
104 checkSize(list.size());
106 for (
unsigned i=0; i<
N; ++i)
113 template<
class T,
unsigned N>
114 template<
unsigned AnyNum>
117 const FixedList<T, AnyNum>& list,
118 const FixedList<label, N>& indices
121 for (
unsigned i=0; i<
N; ++i)
123 v_[i] = list[indices[i]];
128 template<
class T,
unsigned N>
131 const UList<T>& list,
132 const FixedList<label, N>& indices
135 for (
unsigned i=0; i<
N; ++i)
137 v_[i] = list[indices[i]];
142 template<
class T,
unsigned N>
145 checkSize(list.size());
147 auto iter = list.begin();
148 for (
unsigned i=0; i<
N; ++i)
156 template<
class T,
unsigned N>
160 return autoPtr<FixedList<T, N>>
::New(*
this);
166 template<
class T,
unsigned N>
174 template<
class T,
unsigned N>
182 template<
class T,
unsigned N>
186 return reinterpret_cast<const char*
>(v_);
190 template<
class T,
unsigned N>
194 return reinterpret_cast<char*
>(v_);
198 template<
class T,
unsigned N>
205 template<
class T,
unsigned N>
206 template<
unsigned Index>
209 static_assert(Index <
N,
"Address outside FixedList range");
214 template<
class T,
unsigned N>
215 template<
unsigned Index>
218 static_assert(Index <
N,
"Address outside FixedList range");
223 template<
class T,
unsigned N>
230 template<
class T,
unsigned N>
237 template<
class T,
unsigned N>
244 template<
class T,
unsigned N>
251 template<
class T,
unsigned N>
254 return (i ==
N-1 ? 0 : i+1);
258 template<
class T,
unsigned N>
261 return this->operator[](this->fcIndex(i));
265 template<
class T,
unsigned N>
268 return this->operator[](this->fcIndex(i));
272 template<
class T,
unsigned N>
275 return (i ? i-1 :
N-1);
279 template<
class T,
unsigned N>
282 return this->operator[](this->rcIndex(i));
286 template<
class T,
unsigned N>
289 return this->operator[](this->rcIndex(i));
293 template<
class T,
unsigned N>
296 if (start < 0 || (start &&
unsigned(start) >=
N))
300 <<
"start " << start <<
" out of range [0," <<
N <<
")" 306 template<
class T,
unsigned N>
309 if (
unsigned(size) !=
N)
312 <<
"size " << size <<
" != " <<
N 318 template<
class T,
unsigned N>
321 if (i < 0 ||
unsigned(i) >=
N)
324 <<
"index " << i <<
" out of range [0," <<
N <<
")" 330 template<
class T,
unsigned N>
333 if (empty())
return false;
335 for (
unsigned i=1; i<
N; ++i)
347 template<
class T,
unsigned N>
354 return (this->
find(val,
pos) >= 0);
358 template<
class T,
unsigned N>
367 template<
class T,
unsigned N>
376 template<
class T,
unsigned N>
379 for (
unsigned i=0; i<
N; ++i)
386 template<
class T,
unsigned N>
389 for (
unsigned i=0; i<
N; ++i)
396 template<
class T,
unsigned N>
404 for (
unsigned i=0; i<
N; ++i)
411 template<
class T,
unsigned N>
419 for (
unsigned i=0; i<
N; ++i)
421 v_[i] = std::move(list[i]);
428 template<
class T,
unsigned N>
438 template<
class T,
unsigned N>
448 template<
class T,
unsigned N>
451 for (
unsigned i=0; i<
N; ++i)
457 template<
class T,
unsigned N>
460 checkSize(list.size());
462 for (
unsigned i=0; i<
N; ++i)
468 template<
class T,
unsigned N>
471 checkSize(list.size());
473 auto iter = list.begin();
474 for (
unsigned i=0; i<
N; ++i)
481 template<
class T,
unsigned N>
484 checkSize(list.size());
486 auto iter = list.begin();
487 for (
unsigned i=0; i<
N; ++i)
494 template<
class T,
unsigned N>
501 template<
class T,
unsigned N>
508 template<
class T,
unsigned N>
516 for (
unsigned i=0; i<
N; ++i)
522 template<
class T,
unsigned N>
530 for (
unsigned i=0; i<
N; ++i)
532 v_[i] = std::move(list.v_[i]);
539 template<
class T,
unsigned N>
547 template<
class T,
unsigned N>
555 template<
class T,
unsigned N>
563 template<
class T,
unsigned N>
571 template<
class T,
unsigned N>
579 template<
class T,
unsigned N>
587 template<
class T,
unsigned N>
595 template<
class T,
unsigned N>
603 template<
class T,
unsigned N>
611 template<
class T,
unsigned N>
619 template<
class T,
unsigned N>
627 template<
class T,
unsigned N>
631 return const_reverse_iterator(
begin());
void operator=(const T list[N])
Assignment to array operator. Takes linear time.
const char * cdata_bytes() const noexcept
Return pointer to the underlying array serving as data storage,.
void resize(const label n)
Dummy function, to make FixedList consistent with List.
label find(const ListType &input, const UnaryPredicate &pred, const label start=0)
Same as ListOps::find_if.
bool found(const T &val, label pos=0) const
True if the value if found in the list.
std::reverse_iterator< iterator > reverse_iterator
Reverse iterator (non-const access)
A 1D vector of objects of type <T> with a fixed length <N>.
iterator begin() noexcept
Return an iterator to begin traversing the FixedList.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool uniform() const
True if all entries have identical values, and list is non-empty.
iterator end() noexcept
Return an iterator to end traversing the FixedList.
T & back() noexcept
Access last element of the list, position [N-1].
void checkIndex(const label i) const
Check index is within valid range [0,N)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
autoPtr< FixedList< T, N > > clone() const
Clone.
T & operator[](const label i)
Return element of FixedList.
std::reverse_iterator< const_iterator > const_reverse_iterator
Reverse iterator (const access)
dimensionedScalar pos(const dimensionedScalar &ds)
reverse_iterator rend()
Return reverse_iterator to end reverse traversing the FixedList.
const T * cdata() const noexcept
Return pointer to the underlying array serving as data storage.
const T * const_iterator
Random access iterator for traversing FixedList.
static std::streamsize size_bytes() noexcept
Number of contiguous bytes for the list data,.
void checkStart(const label start) const
Check start is within valid range [0,size)
void fill(const T &val)
Assign all entries to the given value.
char * data_bytes() noexcept
Return pointer to the underlying array serving as data storage,.
errorManip< error > abort(error &err)
label fcIndex(const label i) const
Return the forward circular index, i.e. next index which returns to the first at the end of the list...
T * iterator
Random access iterator for traversing FixedList.
T & get() noexcept
Element access using compile-time indexing.
void checkSize(const label size) const
Check size is identical to template parameter N.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
label rcIndex(const label i) const
Return the reverse circular index, i.e. previous index which returns to the last at the beginning of ...
const_iterator cbegin() const noexcept
Return const_iterator to begin traversing the constant FixedList.
const Vector< label > N(dict.get< Vector< label >>("N"))
const_reverse_iterator crend() const
Return const_reverse_iterator to end reverse traversing FixedList.
void resize_nocopy(const label n)
Dummy function, to make FixedList consistent with List.
T & front() noexcept
Access first element of the list, position [0].
const T & rcValue(const label i) const
Return reverse circular value (ie, previous value in the list)
const T & fcValue(const label i) const
Return forward circular value (ie, next value in the list)
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
reverse_iterator rbegin()
Return reverse_iterator to begin reverse traversing the FixedList.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
const_iterator cend() const noexcept
Return const_iterator to end traversing the constant FixedList.
T * data() noexcept
Return pointer to the underlying array serving as data storage.
const_reverse_iterator crbegin() const
Return const_reverse_iterator to begin reverse traversing FixedList.
Non-intrusive singly-linked list.
void transfer(FixedList< T, N > &list)
Transfer by swapping using a move assignment for the content of the individual list elements...
constexpr auto begin(C &c) -> decltype(c.begin())
Return iterator to the beginning of the container c.
static const FixedList< T, N > & null()
Return a null FixedList.
FixedList()=default
Default construct.
void swap(FixedList< T, N > &other)
Swap lists by swapping the content of the individual list elements.
static constexpr const zero Zero
Global zero (0)