37 if (storage_.size() < len)
40 const label newCapacity =
41 max(min_size(),
max(len+1, label(2*storage_.size())));
43 if (nocopy || empty())
48 storage_.resize_nocopy(newCapacity);
53 const labelRange range1 = range_one();
54 const labelRange range2 = range_two();
56 List<T> old(newCapacity);
61 for (
const label i : range1)
63 storage_[end_++] = std::move(old[i]);
65 for (
const label i : range2)
67 storage_[end_++] = std::move(old[i]);
79 const label len = size_one();
80 return (len ? storage_.slice(begin_, len) :
SubList<T>());
87 const label len = size_two();
88 return (len ? storage_.slice(0, len) :
SubList<T>());
95 const label len = size_one();
96 return (len ? storage_.slice(begin_, len) :
SubList<T>());
103 const label len = size_two();
104 return (len ? storage_.slice(0, len) :
SubList<T>());
111 if (
pos < 0)
return -1;
115 const auto list1 = this->array_one();
117 if (
pos < list1.size())
120 i = list1.find(val,
pos);
131 const auto list2 = this->array_two();
133 if (i < 0 && list2.size())
136 i = list2.find(val,
pos);
152 const label
n = this->size();
153 const label nBy2 =
n/2;
155 for (label i = 0; i < nBy2; ++i)
165 const auto list1 = array_one();
166 const auto list2 = array_two();
168 List<T> result(list1.size() + list2.size());
172 result.slice(0, list1.size()) = list1;
176 result.slice(list1.size(), list1.size() + list2.size()) = list2;
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedScalar pos(const dimensionedScalar &ds)
List< T > list() const
Return a copy of the buffer flattened into a single List. Use sparingly!
A List obtained as a section of another List.
A simple list of objects of type <T> that is intended to be used as a circular buffer (eg...
SubList< T > array_one()
The contents of the first internal array.
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
Exchange contents of lists - see DynamicList::swap().
SubList< T > array_two()
The contents of the second internal array.
void reverse()
Reverse the buffer order, swapping elements.
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.