k06a / boolinq

Simplest C++ header-only LINQ template library
MIT License
628 stars 79 forks source link

SelectMany #38

Closed rohanaceres closed 4 years ago

rohanaceres commented 4 years ago

Hi,

How can I selectMany with objects? For example:

auto concatInnerList =
    from(*myObj)
        .selectMany([](const MyObj& myObjTemp) { return myObjTemp.innerList; })
        .toStdArray();

myObj is a std::vector<MyObject> which contains an inner list object std::vector.

k06a commented 4 years ago

Hi @rohanaceres, try return from(myObjTemp.innerList);

k06a commented 4 years ago

You can find all examples in test folder: https://github.com/k06a/boolinq/blob/master/test/SelectManyTest.cpp#L29