Monday, September 25, 2017

C++14: Deduced Return Type

C++14 allows all functions to deduce the return type. C++11 only allowed lambda functions to do this. Here is an example:

auto myFunction()
{
  return 1;
}

int main()
{
  int i = myFunction();

  return 0;
}
Reference: https://en.wikipedia.org/wiki/C%2B%2B14#Function_return_type_deduction

No comments:

Post a Comment