1

In this example,

#include "crow.h"

int main(){
  crow::SimpleApp app;

  CROW_ROUTE(app, "/")([](){
    return "Hello world";
  });
app.port(18080).multithreaded().run();
}

What does this snippet ([](){ refer to ?

I cannot seem to find any reference to this in the C++ docs.

CharlieC
  • 123
  • 1
  • 8
  • http://en.cppreference.com/w/cpp/language/lambda – Igor Tandetnik Feb 09 '17 at 00:07
  • @IgorTandetnik it starts with () however ? – CharlieC Feb 09 '17 at 00:14
  • The opening paren in front of `[]` is part of a function call; the matching closing paren is two lines down, after a brace. You have a lambda being passed as an argument to a function. In other words: `auto lambda = [](){...}; CROW_ROUTE(app, "/")(lambda);` – Igor Tandetnik Feb 09 '17 at 01:49

0 Answers0