ENH: add subsetList/inplaceSubsetList functions with unary predicate

- these are suitable for use with lambda functions.

- Deprecate the unused 3-parameter version of subset/inplaceSubset.

- Deprecate initList and initListList in favour of initializer_list

STYLE: adjust some comments, remove dead code in regionSizeDistribution.C
This commit is contained in:
Mark Olesen
2017-03-07 17:00:30 +01:00
parent 865f09e623
commit b7dc6d0441
6 changed files with 135 additions and 82 deletions

View File

@ -109,7 +109,21 @@ int main(int argc, char *argv[])
SubList<label> test5SubList(test5, 4, 3);
Info<< "List : " << test5 << endl;
inplaceReverseList(test5SubList);
Info<< "Reverse Sublist between 3 and 6 : " << test5 << endl;
Info<< "Reverse Sublist between 3 and 6 : " << test5 << nl << endl;
Info<< nl << "Test lambda predicates:" << nl << endl;
List<label> test6(identity(19));
// shift range for general testing
std::for_each(test6.begin(), test6.end(), [](label& x){ x -= 10; });
Info<< "Subset of non-zero, even values: "
<< subsetList
(
test6,
[](const label& x){ return x && !(x % 2); }
) << nl
<< endl;
Info<< "\nEnd\n" << endl;