lundi 31 août 2015

Are auto in temple parameter list in lambdas part of the standard?

Today, I stumbled across the following code snippet:

#include <utility>

int main()
{

  auto a = [](std::pair<auto, auto> value)
  {

  };

  a(std::pair<int, bool>{ 3, true });
}

http://cpp.sh/5p34

I have only one question: is this code supported by the standard?

It compiles in GCC (with -std=c++14), but not clang or Visual Studio 2015 (VC++14).

This seems like it should be part of the standard because if lambdas should have the same template support as regular functions, then this should be supported.

This seems to convert to all template types, not just std::pair.

Aucun commentaire:

Enregistrer un commentaire