FixedList.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2017-2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::FixedList
29 
30 Description
31  A 1D vector of objects of type <T> with a fixed length <N>.
32 
33 SourceFiles
34  FixedList.C
35  FixedListI.H
36  FixedListIO.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef Foam_FixedList_H
41 #define Foam_FixedList_H
42 
43 #include "bool.H"
44 #include "label.H"
45 #include "uLabel.H"
46 #include "zero.H"
47 #include "contiguous.H"
48 #include "stdFoam.H"
49 #include "autoPtr.H"
50 #include "Hash.H"
51 #include "SLListFwd.H"
52 #include "ListPolicy.H"
53 
54 #include <iterator>
55 #include <limits>
56 #include <type_traits>
57 
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 
60 namespace Foam
61 {
62 
63 // Forward Declarations
64 
65 template<class T, unsigned N> class FixedList;
66 template<class T> class UList;
67 
68 template<class T, unsigned N>
69 Istream& operator>>(Istream& is, FixedList<T, N>& list);
70 
71 template<class T, unsigned N>
72 Ostream& operator<<(Ostream& os, const FixedList<T, N>& list);
73 
74 
75 /*---------------------------------------------------------------------------*\
76  Class FixedList Declaration
77 \*---------------------------------------------------------------------------*/
78 
79 template<class T, unsigned N>
80 class FixedList
81 {
82  static_assert
83  (
85  "Size must be positive (non-zero) and fit as a signed int value"
86  );
87 
88  // Private Data
89 
90  //- Vector of values of type T of length N.
91  T v_[N];
92 
93 
94 protected:
95 
96  // Protected Member Functions
97 
98  //- Write the FixedList with its compound type
99  void writeEntry(Ostream& os) const;
100 
101 
102 public:
103 
104  // STL Type Definitions
105 
106  //- The value type the FixedList contains
107  typedef T value_type;
109  //- The pointer type for non-const access to value_type items
110  typedef T* pointer;
111 
112  //- The pointer type for const access to value_type items
113  typedef const T* const_pointer;
114 
115  //- The type used for storing into value_type objects
116  typedef T& reference;
117 
118  //- The type used for reading from constant value_type objects.
119  typedef const T& const_reference;
120 
121  //- Random access iterator for traversing FixedList
122  typedef T* iterator;
124  //- Random access iterator for traversing FixedList
125  typedef const T* const_iterator;
126 
127  //- The type to represent the size of a FixedList
128  typedef label size_type;
129 
130  //- The difference between iterator objects
131  typedef label difference_type;
132 
133  //- Reverse iterator (non-const access)
134  typedef std::reverse_iterator<iterator> reverse_iterator;
135 
136  //- Reverse iterator (const access)
137  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
139 
140  // Static Functions
141 
142  //- Return a null FixedList
143  inline static const FixedList<T, N>& null();
144 
145 
146  // Constructors
147 
148  //- Default construct
149  FixedList() = default;
150 
151  //- Construct and initialize all entries to given value
152  inline explicit FixedList(const T& val);
154  //- Construct and initialize all entries to zero
155  inline explicit FixedList(const Foam::zero);
156 
157  //- Copy construct from C-array (deprecated)
158  inline explicit FixedList(const T list[N]);
159 
160  //- Copy construct
161  inline FixedList(const FixedList<T, N>& list);
162 
163  //- Move construct by using move assignment for the individual
164  //- list elements
165  inline FixedList(FixedList<T, N>&& list);
166 
167  //- Construct from an initializer list. Runtime size check
168  inline FixedList(std::initializer_list<T> list);
169 
170  //- Construct from UList. Runtime size check
171  inline explicit FixedList(const UList<T>& list);
172 
173  //- Copy construct from a subset of the input. No size check
174  template<unsigned AnyNum>
175  inline FixedList
176  (
177  const FixedList<T, AnyNum>& list,
178  const FixedList<label, N>& indices
179  );
180 
181  //- Copy construct from a subset of the input. No size check
182  inline FixedList
183  (
184  const UList<T>& list,
185  const FixedList<label, N>& indices
186  );
187 
188  //- Construct from SLList. Runtime size check
189  inline explicit FixedList(const SLList<T>& list);
190 
191  //- Construct from Istream
192  explicit FixedList(Istream& is);
193 
194  //- Clone
195  inline autoPtr<FixedList<T, N>> clone() const;
196 
197 
198  // Member Functions
199 
200  // Access
201 
202  //- Return pointer to the underlying array serving as data storage.
203  inline const T* cdata() const noexcept;
204 
205  //- Return pointer to the underlying array serving as data storage.
206  inline T* data() noexcept;
207 
208  //- Return pointer to the underlying array serving as data storage,
209  // reinterpreted as byte data
210  // \note Only meaningful for contiguous data
211  inline const char* cdata_bytes() const noexcept;
212 
213  //- Return pointer to the underlying array serving as data storage,
214  // reinterpreted as byte data
215  // \note Only meaningful for contiguous data
216  inline char* data_bytes() noexcept;
217 
218  //- Number of contiguous bytes for the list data,
219  // \note Only meaningful for contiguous data
220  inline static std::streamsize size_bytes() noexcept;
221 
222  //- Number of contiguous bytes for the list data,
223  //- runtime FatalError if type is not contiguous
224  static std::streamsize byteSize();
225 
226  //- Element access using compile-time indexing
227  template<unsigned Index>
228  inline T& get() noexcept;
229 
230  //- Element access using compile-time indexing
231  template<unsigned Index>
232  inline const T& get() const noexcept;
233 
234  //- Access first element of the list, position [0]
235  inline T& front() noexcept;
236 
237  //- Access first element of the list, position [0]
238  inline const T& front() const noexcept;
239 
240  //- Access last element of the list, position [N-1]
241  inline T& back() noexcept;
242 
243  //- Access last element of the list, position [N-1]
244  inline const T& back() const noexcept;
245 
246  //- Return the forward circular index, i.e. next index
247  //- which returns to the first at the end of the list
248  inline label fcIndex(const label i) const;
249 
250  //- Return forward circular value (ie, next value in the list)
251  inline const T& fcValue(const label i) const;
252 
253  //- Return forward circular value (ie, next value in the list)
254  inline T& fcValue(const label i);
255 
256  //- Return the reverse circular index, i.e. previous index
257  //- which returns to the last at the beginning of the list
258  inline label rcIndex(const label i) const;
259 
260  //- Return reverse circular value (ie, previous value in the list)
261  inline const T& rcValue(const label i) const;
262 
263  //- Return reverse circular value (ie, previous value in the list)
264  inline T& rcValue(const label i);
265 
266 
267  // Check
268 
269  //- Check start is within valid range [0,size)
270  inline void checkStart(const label start) const;
271 
272  //- Check size is identical to template parameter N
273  inline void checkSize(const label size) const;
274 
275  //- Check index is within valid range [0,N)
276  inline void checkIndex(const label i) const;
277 
278  //- True if all entries have identical values, and list is non-empty
279  inline bool uniform() const;
280 
281 
282  // Search
283 
284  //- Find index of the first occurrence of the value.
285  // Any occurrences before the start pos are ignored.
286  // Linear search.
287  // \return -1 if not found.
288  label find(const T& val, label pos = 0) const;
289 
290  //- Find index of the last occurrence of the value.
291  // Any occurrences after the end pos are ignored.
292  // Linear search.
293  // \return position in list or -1 if not found.
294  label rfind(const T& val, label pos = -1) const;
295 
296  //- Is the value contained in the list?
297  // Linear search from start pos until the end of the list.
298  // Any occurrences before the start pos are ignored.
299  // \return true if found.
300  inline bool contains(const T& val, label pos = 0) const;
301 
302 
303  // Edit
304 
305  //- Dummy function, to make FixedList consistent with List
306  inline void resize(const label n);
307 
308  //- Dummy function, to make FixedList consistent with List
309  inline void resize_nocopy(const label n);
310 
311  //- Dummy function, to make FixedList consistent with List
312  void setSize(const label n) { this->resize(n); }
313 
314  //- Assign all entries to the given value
315  inline void fill(const T& val);
316 
317  //- Assign all entries to zero
318  inline void fill(const Foam::zero);
319 
320  //- Move element to the first position.
321  void moveFirst(const label i);
322 
323  //- Move element to the last position.
324  void moveLast(const label i);
325 
326  //- Swap element with the first element.
327  void swapFirst(const label i);
328 
329  //- Swap element with the last element.
330  void swapLast(const label i);
331 
332  //- Transfer by swapping using a move assignment for the content
333  //- of the individual list elements
334  inline void transfer(FixedList<T, N>& list);
335 
336 
337  // Member Operators
338 
339  //- Return element of FixedList
340  inline T& operator[](const label i);
341 
342  //- Return element of constant FixedList
343  inline const T& operator[](const label i) const;
344 
345  //- Assignment to array operator. Takes linear time
346  inline void operator=(const T list[N]);
347 
348  //- Assignment to UList operator. Takes linear time
349  inline void operator=(const UList<T>& list);
350 
351  //- Assignment to SLList operator. Takes linear time
352  inline void operator=(const SLList<T>& list);
353 
354  //- Assignment to an initializer list. Takes linear time
355  inline void operator=(std::initializer_list<T> list);
356 
357  //- Assign all entries to the given value. fill()
358  inline void operator=(const T& val);
359 
360  //- Assign all entries to zero. fill()
361  inline void operator=(const Foam::zero);
362 
363  //- Copy assignment
364  inline void operator=(const FixedList<T, N>& list);
365 
366  //- Move assignment
367  inline void operator=(FixedList<T, N>&& list);
368 
369 
370  // Random access iterator (non-const)
371 
372  //- Return an iterator to begin traversing the FixedList
373  inline iterator begin() noexcept;
374 
375  //- Return an iterator to end traversing the FixedList
376  inline iterator end() noexcept;
377 
378 
379  // Random access iterator (const)
380 
381  //- Return const_iterator to begin traversing the constant FixedList
382  inline const_iterator cbegin() const noexcept;
383 
384  //- Return const_iterator to end traversing the constant FixedList
385  inline const_iterator cend() const noexcept;
386 
387  //- Return const_iterator to begin traversing the constant FixedList
388  inline const_iterator begin() const noexcept;
389 
390  //- Return const_iterator to end traversing the constant FixedList
391  inline const_iterator end() const noexcept;
392 
393 
394  // Reverse iterator (non-const)
395 
396  //- Return reverse_iterator to begin reverse traversing the FixedList
397  inline reverse_iterator rbegin();
398 
399  //- Return reverse_iterator to end reverse traversing the FixedList
400  inline reverse_iterator rend();
401 
402 
403  // Reverse iterator (const)
404 
405  //- Return const_reverse_iterator to begin reverse traversing FixedList
406  inline const_reverse_iterator crbegin() const;
407 
408  //- Return const_reverse_iterator to end reverse traversing FixedList
409  inline const_reverse_iterator crend() const;
410 
411  //- Return const_reverse_iterator to begin reverse traversing FixedList
412  inline const_reverse_iterator rbegin() const;
413 
414  //- Return const_reverse_iterator to end reverse traversing FixedList
415  inline const_reverse_iterator rend() const;
416 
417 
418  // STL Member Functions
419 
420  //- Always false since zero-sized FixedList is compile-time disabled.
421  static constexpr bool empty() noexcept { return !N; }
422 
423  //- Return the number of elements in the FixedList
424  static constexpr label size() noexcept { return N; }
425 
426  //- The dimensioned size (template parameter N) of the FixedList
427  static constexpr unsigned max_size() noexcept { return N; }
428 
429  //- Swap lists by swapping the content of the individual list elements
430  inline void swap(FixedList<T, N>& other);
431 
432 
433  // STL Member Operators
434 
435  //- Equality operation on FixedLists of the same type.
436  // Returns true when the FixedLists are element-wise equal
437  // (using FixedList::value_type::operator==). Takes linear time
438  bool operator==(const FixedList<T, N>& list) const;
439 
440  //- The opposite of the equality operation. Takes linear time
441  bool operator!=(const FixedList<T, N>& list) const;
442 
443  //- Compare two FixedLists lexicographically. Takes linear time
444  bool operator<(const FixedList<T, N>& list) const;
445 
446  //- Compare two FixedLists lexicographically. Takes linear time
447  bool operator>(const FixedList<T, N>& list) const;
448 
449  //- Return true if !(a > b). Takes linear time
450  bool operator<=(const FixedList<T, N>& list) const;
451 
452  //- Return true if !(a < b). Takes linear time
453  bool operator>=(const FixedList<T, N>& list) const;
454 
455 
456  // Reading/writing
457 
458  //- Read from Istream, discarding contents of existing List
459  Istream& readList(Istream& is);
460 
461  //- Write the list as a dictionary entry with keyword
462  void writeEntry(const word& keyword, Ostream& os) const;
463 
464  //- Write List, with line-breaks in ASCII when length exceeds shortLen.
465  // Using '0' suppresses line-breaks entirely.
466  Ostream& writeList(Ostream& os, const label shortLen=0) const;
467 
468 
469  // IOstream Operators
470 
471  //- Use the readList() method to read contents from Istream.
472  friend Istream& operator>> <T, N>
473  (
474  Istream& is,
475  FixedList<T, N>& list
476  );
477 
478 
479  // Hashing
480 
481  //- Hashing functor for FixedList.
482  struct hasher
483  {
484  inline unsigned operator()
485  (
486  const FixedList<T, N>& obj,
487  unsigned seed=0
488  ) const
489  {
490  if (is_contiguous<T>::value)
491  {
492  return Foam::Hasher(obj.cdata(), obj.size_bytes(), seed);
493  }
494 
495  Foam::Hash<T> op;
496  for (const T& val : obj)
497  {
498  seed = op(val, seed);
499  }
500  return seed;
501  }
502  };
503 
504  //- Deprecated(2021-04) hashing functor. Use hasher()
505  // \deprecated(2021-04) - use hasher() functor
506  template<class Unused=bool>
507  struct Hash : FixedList<T, N>::hasher
508  {
509  FOAM_DEPRECATED_FOR(2021-04, "hasher()") Hash() {}
510  };
511 
512 
513  // Housekeeping
514 
515  //- Access first element of the list, position [0] - front()
516  T& first() noexcept { return front(); }
517 
518  //- Access first element of the list, position [0] - front()
519  const T& first() const noexcept { return front(); }
520 
521  //- Access last element of the list, position [N-1] - back()
522  T& last() noexcept { return back(); }
523 
524  //- Access last element of the list, position [N-1] - back()
525  const T& last() const noexcept { return back(); }
526 
527  //- Same as contains()
528  bool found(const T& val, label pos = 0) const
529  {
530  return this->contains(val, pos);
531  }
532 };
533 
534 
535 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
536 
537 //- FixedList is contiguous if the type is contiguous
538 template<class T, unsigned N>
539 struct is_contiguous<FixedList<T, N>> : is_contiguous<T> {};
540 
541 //- Check for FixedList of labels
542 template<class T, unsigned N>
543 struct is_contiguous_label<FixedList<T, N>> : is_contiguous_label<T> {};
544 
545 //- Check for FixedList of scalars
546 template<class T, unsigned N>
547 struct is_contiguous_scalar<FixedList<T, N>> : is_contiguous_scalar<T> {};
548 
549 //- Hashing for FixedList data
550 template<class T, unsigned N>
551 struct Hash<FixedList<T, N>> : FixedList<T, N>::hasher {};
552 
553 
554 // * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * * //
555 
556 //- Swap FixedList contents - see FixedList::swap().
557 // Internally actually swaps the individual list elements
558 template<class T, unsigned N>
559 inline void Swap(FixedList<T, N>& a, FixedList<T, N>& b)
560 {
561  a.swap(b);
562 }
563 
564 
565 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
566 
567 //- Read List contents from Istream, list must have the proper size!
568 template<class T, unsigned N>
569 Istream& operator>>(Istream& is, FixedList<T, N>& list)
570 {
571  return list.readList(is);
572 }
573 
574 
575 //- Write List to Ostream, as per FixedList::writeList() with default length.
576 // The default short-length is given by Detail::ListPolicy::short_length
577 template<class T, unsigned N>
578 Ostream& operator<<(Ostream& os, const FixedList<T, N>& list)
579 {
580  return list.writeList(os, Detail::ListPolicy::short_length<T>::value);
581 }
582 
583 
584 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
585 
586 } // End namespace Foam
587 
588 
589 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
590 
591 #include "FixedListI.H"
593 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
594 
595 #ifdef NoRepository
596  #include "FixedList.C"
597  #include "FixedListIO.C"
598 #endif
599 
600 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
601 
602 #endif
603 
604 // ************************************************************************* //
void operator=(const T list[N])
Assignment to array operator. Takes linear time.
Definition: FixedListI.H:438
const char * cdata_bytes() const noexcept
Return pointer to the underlying array serving as data storage,.
Definition: FixedListI.H:177
void resize(const label n)
Dummy function, to make FixedList consistent with List.
Definition: FixedListI.H:348
bool found(const T &val, label pos=0) const
Same as contains()
Definition: FixedList.H:742
bool operator!=(const FixedList< T, N > &list) const
The opposite of the equality operation. Takes linear time.
Definition: FixedList.C:186
std::reverse_iterator< iterator > reverse_iterator
Reverse iterator (non-const access)
Definition: FixedList.H:153
label difference_type
The difference between iterator objects.
Definition: FixedList.H:148
T * pointer
The pointer type for non-const access to value_type items.
Definition: FixedList.H:113
const T & const_reference
The type used for reading from constant value_type objects.
Definition: FixedList.H:128
A 1D vector of objects of type <T> with a fixed length <N>.
Definition: HashTable.H:101
iterator begin() noexcept
Return an iterator to begin traversing the FixedList.
Definition: FixedListI.H:530
static constexpr bool empty() noexcept
Always false since zero-sized FixedList is compile-time disabled.
Definition: FixedList.H:592
void moveLast(const label i)
Move element to the last position.
Definition: FixedList.C:102
bool operator==(const FixedList< T, N > &list) const
Equality operation on FixedLists of the same type.
Definition: FixedList.C:142
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:40
Template class for non-intrusive linked lists.
Definition: LList.H:46
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
T & reference
The type used for storing into value_type objects.
Definition: FixedList.H:123
static std::streamsize byteSize()
Number of contiguous bytes for the list data, runtime FatalError if type is not contiguous.
Definition: FixedList.C:28
bool contains(const T &val, label pos=0) const
Is the value contained in the list?
Definition: FixedListI.H:341
iterator end() noexcept
Return an iterator to end traversing the FixedList.
Definition: FixedListI.H:554
T & back() noexcept
Access last element of the list, position [N-1].
Definition: FixedListI.H:231
void checkIndex(const label i) const
Check index is within valid range [0,N)
Definition: FixedListI.H:312
autoPtr< FixedList< T, N > > clone() const
Clone.
Definition: FixedListI.H:151
void writeEntry(Ostream &os) const
Write the FixedList with its compound type.
Definition: FixedListIO.C:30
void setSize(const label n)
Dummy function, to make FixedList consistent with List.
Definition: FixedList.H:423
static constexpr unsigned max_size() noexcept
The dimensioned size (template parameter N) of the FixedList.
Definition: FixedList.H:602
Forward declarations for SLList.
T & operator[](const label i)
Return element of FixedList.
Definition: FixedListI.H:418
label size_type
The type to represent the size of a FixedList.
Definition: FixedList.H:143
std::reverse_iterator< const_iterator > const_reverse_iterator
Reverse iterator (const access)
Definition: FixedList.H:158
static constexpr label size() noexcept
Return the number of elements in the FixedList.
Definition: FixedList.H:597
dimensionedScalar pos(const dimensionedScalar &ds)
reverse_iterator rend()
Return reverse_iterator to end reverse traversing the FixedList.
Definition: FixedListI.H:602
const T * cdata() const noexcept
Return pointer to the underlying array serving as data storage.
Definition: FixedListI.H:161
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
const T * const_iterator
Random access iterator for traversing FixedList.
Definition: FixedList.H:138
bool operator>(const FixedList< T, N > &list) const
Compare two FixedLists lexicographically. Takes linear time.
Definition: FixedList.C:193
static std::streamsize size_bytes() noexcept
Number of contiguous bytes for the list data,.
Definition: FixedListI.H:192
void checkStart(const label start) const
Check start is within valid range [0,size)
Definition: FixedListI.H:287
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
Definition: FixedListIO.C:75
Istream & operator>>(Istream &, directionInfo &)
T & first() noexcept
Access first element of the list, position [0] - front()
Definition: FixedList.H:722
void swapFirst(const label i)
Swap element with the first element.
Definition: FixedList.C:114
void fill(const T &val)
Assign all entries to the given value.
Definition: FixedListI.H:366
char * data_bytes() noexcept
Return pointer to the underlying array serving as data storage,.
Definition: FixedListI.H:185
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:99
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...
Definition: FixedListI.H:245
T * iterator
Random access iterator for traversing FixedList.
Definition: FixedList.H:133
const direction noexcept
Definition: Scalar.H:258
T & get() noexcept
Element access using compile-time indexing.
Definition: FixedListI.H:200
void checkSize(const label size) const
Check size is identical to template parameter N.
Definition: FixedListI.H:300
OBJstream os(runTime.globalPath()/outputName)
Database for solution data, solver performance and other reduced data.
Definition: data.H:52
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
label rcIndex(const label i) const
Return the reverse circular index, i.e. previous index which returns to the last at the beginning of ...
Definition: FixedListI.H:266
const_iterator cbegin() const noexcept
Return const_iterator to begin traversing the constant FixedList.
Definition: FixedListI.H:546
const Vector< label > N(dict.get< Vector< label >>("N"))
const_reverse_iterator crend() const
Return const_reverse_iterator to end reverse traversing FixedList.
Definition: FixedListI.H:618
label rfind(const T &val, label pos=-1) const
Find index of the last occurrence of the value.
Definition: FixedList.C:65
T & last() noexcept
Access last element of the list, position [N-1] - back()
Definition: FixedList.H:732
unsigned Hasher(const void *data, size_t len, unsigned seed=0)
Bob Jenkins&#39;s 96-bit mixer hashing function (lookup3)
Definition: Hasher.C:575
void resize_nocopy(const label n)
Dummy function, to make FixedList consistent with List.
Definition: FixedListI.H:357
T value_type
The value type the FixedList contains.
Definition: FixedList.H:108
T & front() noexcept
Access first element of the list, position [0].
Definition: FixedListI.H:217
const T & rcValue(const label i) const
Return reverse circular value (ie, previous value in the list)
Definition: FixedListI.H:273
Hash function class. The default definition is for primitives. Non-primitives used to hash entries on...
Definition: Hash.H:47
const T & fcValue(const label i) const
Return forward circular value (ie, next value in the list)
Definition: FixedListI.H:252
const T * const_pointer
The pointer type for const access to value_type items.
Definition: FixedList.H:118
Istream & readList(Istream &is)
Read from Istream, discarding contents of existing List.
Definition: FixedListIO.C:146
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
Definition: DynamicList.H:659
reverse_iterator rbegin()
Return reverse_iterator to begin reverse traversing the FixedList.
Definition: FixedListI.H:578
FOAM_DEPRECATED_FOR(2021-04, "hasher()") Hash()
Definition: FixedList.H:713
Includes some standard C++ headers, defines global macros and templates used in multiple places by Op...
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:57
label n
void moveFirst(const label i)
Move element to the first position.
Definition: FixedList.C:90
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
void swapLast(const label i)
Swap element with the last element.
Definition: FixedList.C:126
const_iterator cend() const noexcept
Return const_iterator to end traversing the constant FixedList.
Definition: FixedListI.H:570
const_reverse_iterator crbegin() const
Return const_reverse_iterator to begin reverse traversing FixedList.
Definition: FixedListI.H:594
void transfer(FixedList< T, N > &list)
Transfer by swapping using a move assignment for the content of the individual list elements...
Definition: FixedListI.H:401
static const FixedList< T, N > & null()
Return a null FixedList.
Definition: FixedListI.H:28
bool operator>=(const FixedList< T, N > &list) const
Return true if !(a < b). Takes linear time.
Definition: FixedList.C:207
System bool.
Namespace for OpenFOAM.
FixedList()=default
Default construct.
void swap(FixedList< T, N > &other)
Swap lists by swapping the content of the individual list elements.
Definition: FixedListI.H:386
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
Definition: FixedList.C:43