Quick Q: A positive lambda: +[]{} -- What sorcery is this?

Yesterday on SO:

A positive lambda: +[]{} -- What sorcery is this?

Does anyone know why this

#include <functional>

int main() {
  auto test = +[]{}; // note the unary operator + before the lambda
  test = []{};
}

works? It compiles fine with both GCC 4.7+ and Clang 3.2+. Is the code standard conforming?

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.