pfultz2/Linq

Cannot use function output as initial value

amosialek opened this issue · 1 comments

This code won't compile:

#include <linq.h>
#include<vector>
using namespace linq;
std::vector<int> f()
{
std::vector<int> result;
return result;
}
int main()
{
  auto x = f() | linq::first;
}

however this one will

#include <linq.h>
#include<vector>
std::vector<int> f()
{
std::vector<int> result;
return result;
}
int main()
{
  auto output = f();
  auto x = output | linq::first;
}

The issue is that LINQ should work with function output as well as with variable collection (and it does not)

what's more, following query would work

output | linq::intersect(f());

but

f() | linq::intersect(f());

would not