Tag Archives: C++14

C++14: Runtime-sized arrays

More details on the ISO C++ blog about runtime-sized arrays in C++14.

N3639 proposes to add local runtime-sized arrays with automatic storage duration to C++, for example:

void f(std::size_t n)
{
int a[n];
for (std::size_t i = 0; i < n; ++i)
{
a[i] = 2*i;
}
std::sort(a, a+n);
}

Traditionally, the array bound ā€œnā€ had to be a constant expression.

2 Comments

Filed under C++, Programming

ISO C++ Spring 2013 Report

Herb Sutter has posted his trip report from the ISO C++ Spring 2013 meeting in Bristol.

The post includes details on features to be included in C++14, including:

  • std::make_unique – never use “new” again
  • Generic lambdas – allow auto for type name in lambdas
  • Dynamic arrays – stack-based arrays can take size parameter at runtime
  • std::optional – for variables that are ‘not set’ (like F# option)
  • Concepts lite – constraints for templates

Leave a comment

Filed under C++, Programming