In his talk at cppcon (~13 mins in), Andrew Sutton mentions that you will "soon" be able to write
auto func(auto a, auto b) { ... }
which will be taken to mean
template <typename T, typename U> auto func(T a, U b) { ... }
just as was introduced for generic lambdas in C++14.
What is the name for this feature?
Is this a part of Concepts Lite, or was it proposed separately?
This obviously didn't make it into C++14 if it was indeed proposed; if anybody knows, what were the objections raised against it?
A non-type template argument provided within a template argument list is an expression whose value can be determined at compile time. Such arguments must be constant expressions, addresses of functions or objects with external linkage, or addresses of static class members.
A template argument for a template template parameter is the name of a class template. When the compiler tries to find a template to match the template template argument, it only considers primary class templates. (A primary template is the template that is being specialized.)
In C++ this can be achieved using template parameters. A template parameter is a special kind of parameter that can be used to pass a type as argument: just like regular function parameters can be used to pass values to a function, template parameters allow to pass also types to a function.
Template parameters may have default arguments. The set of default template arguments accumulates over all declarations of a given template.
Read all about it in the latest draft of the concepts TS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With