mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
added xfer<...> transfer() method to various containers
- this should provide a slightly more naturally means to using transfer
constructors, for example
labelList list2(list1.transfer());
vs. labelList list2(xferMove(list1));
- returns a plain list where appropriate (eg, DynamicList, SortableList)
for example
labelList list2(dynList1.transfer());
vs. labelList list2(xferMoveTo<labelList>(dynList1));
This commit is contained in:
@ -145,6 +145,14 @@ int main(int argc, char *argv[])
|
||||
Info<< "<dlC>" << dlC << "</dlC>" << nl << "sizes: "
|
||||
<< " " << dlC.size() << "/" << dlC.capacity() << endl;
|
||||
|
||||
List<label> lstB(dlC.transfer());
|
||||
|
||||
Info<< "Transferred to normal list via the transfer() method" << endl;
|
||||
Info<< "<lstB>" << lstB << "</lstB>" << nl << "sizes: "
|
||||
<< " " << lstB.size() << endl;
|
||||
Info<< "<dlC>" << dlC << "</dlC>" << nl << "sizes: "
|
||||
<< " " << dlC.size() << "/" << dlC.capacity() << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -54,6 +54,11 @@ int main(int argc, char *argv[])
|
||||
list2.setSize(10, vector(1, 2, 3));
|
||||
Info<< list2 << endl;
|
||||
|
||||
List<vector> list3(list2.transfer());
|
||||
Info<< "Transferred via the transfer() method" << endl;
|
||||
Info<< list2 << endl;
|
||||
Info<< list3 << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -104,6 +104,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<<"list1: " << list1 << endl;
|
||||
|
||||
PtrList<Scalar> list3(list1.transfer());
|
||||
Info<< "Transferred via the transfer() method" << endl;
|
||||
|
||||
Info<<"list1: " << list1 << endl;
|
||||
Info<<"list2: " << list2 << endl;
|
||||
Info<<"list3: " << list3 << endl;
|
||||
|
||||
Info<< nl << "Done." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user