Does not recognize C++ lambda function
Opened this issue · 0 comments
Leedehai commented
Code:
#include
#include
using namespace std;
struct film {std::string title; int year;};
int main() {
void *actorFile = NULL; // I modified it to NULL for simplicity.
string player("Player");
int numActors = 0; // // I modified it to 0 for simplicity.
int *firstIter = (int *)actorFile + 1 + 0;
int *lastIter = (int *)actorFile + 1 + numActors;
int *iter = lower_bound(firstIter, lastIter, player, [&](int actorInfoOffset, const string &targetName){
string actorName((char *)actorFile + actorInfoOffset);
return actorName < targetName;
});
return 0;
}
Problem: "[" inside the function body is underlined, saying "expected expression".