mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
ENH: eliminate reliance on SLList during reading
- fully implement DynamicList::readList() instead of simply redirecting to List::readList(). This also benefits DynamicField. Leverage DynamicList reading to simplify and improve CircularBuffer reading. - bracket lists are now read chunk-wise instead of using a singly-linked list. For integral and vector-space types (eg, scalar, vector, etc) this avoids intermediate allocations for each element. ENH: add CircularBuffer emplace_front/emplace_back STYLE: isolate to-be-deprecated construct/assign forms - still have construct/assign FixedList from a C-array. This is not really needed, can use std::initializer_list - still have construct/assign List from SLList. Prefer to avoid these in the future. DEFEATURE: remove construct/assign FixedList from SLList - never used DEFEATURE: remove move construct/assign List from SLList - now unused. Retain copy construct/assign from SLList for transition purposes.
This commit is contained in:
@ -202,14 +202,31 @@ int main(int argc, char *argv[])
|
||||
Info<< "get<3>: " << list1.get<3>() << nl;
|
||||
// Will not compile: Info<< "get<4>: " << list1.get<4>() << nl;
|
||||
|
||||
label a[4] = {0, 1, 2, 3};
|
||||
FixedList<label, 4> list2(a);
|
||||
// Test deprecated form
|
||||
label array2[4] = {0, 1, 2, 3};
|
||||
FixedList<label, 4> list2(array2);
|
||||
|
||||
Info<< "list2:" << list2
|
||||
<< " hash:" << FixedList<label, 4>::hasher()(list2) << nl
|
||||
<< " hash:" << Hash<FixedList<label, 4>>()(list2) << nl;
|
||||
|
||||
|
||||
// Test deprecated form
|
||||
SLList<label> sllist3;
|
||||
{
|
||||
sllist3.push_back(0);
|
||||
sllist3.push_back(1);
|
||||
sllist3.push_back(2);
|
||||
sllist3.push_back(3);
|
||||
}
|
||||
FixedList<label, 4> list3(sllist3);
|
||||
|
||||
Info<< "list3:" << list3 << nl;
|
||||
// Test deprecated forms
|
||||
list3 = array2;
|
||||
list2 = sllist3;
|
||||
|
||||
|
||||
// Using FixedList for content too
|
||||
{
|
||||
List<FixedList<label, 4>> twolists{list1, list2};
|
||||
|
||||
Reference in New Issue
Block a user