k06a / boolinq

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

no instance of function template "boolinq::Linq<S, T>::select #45

Closed Ruffo324 closed 4 years ago

Ruffo324 commented 4 years ago

Hello there, first of all, I have a big compliment to offer. Wonderful work. 👍

I wanted to use boolinq on my current platform.io esp32 project. However, I always get the following error when using select:

no instance of function template "boolinq::Linq<S, T>::select [with S=std::tuple<boolinq::Linq<std::pair<const int , const int >, int>, int>, T=int]" matches the argument list -- argument types are: (lambda []int (int a)->int) -- object type is: boolinq::Linq<std::tuple<boolinq::Linq<std::pair<const int , const int >, int>, int>, int>

Using the example from the readme.

using namespace boolinq;

int src[] = {1, 2, 3, 4, 5, 6, 7, 8};
auto dst = from(src).where([](int a) { return a % 2 == 1; })      // 1,3,5,7
                    .select([](int a) { return a * 2; })          // 2,6,10,14
                    .where([](int a) { return a > 2 && a < 12; }) // 6,10
                    .toStdVector();

is this due to the compiler used by platform.io? Do I have to include the file differently?

Thanks for your help. Greetings Ruffo

k06a commented 4 years ago

I suspect your compiler somehow wrongly recognized lambda:

argument types are: (lambda []int (int a)->int)

The middle part []int seems wrong to me, check how your compiler supports lambdas.

Ruffo324 commented 4 years ago

But this libary works fine. https://github.com/luisllamasbinaburo/ArduinoLinq

auto filesData = from(_files) >> select([](file_fileService f) { return (LoggerTableRow){f.path, f.type}; }) >> to_vector();

just found it interesting, other functions from your libary works fine. Only select wont.

But can be closed, if u dont want to do some more investigations for arduino/esp32 support :)