Limitations of C++20 abbreviated function templates

Viewed 31

This is OK:

template<typename T> void test1(T x) {}
void abbreviated_test1(auto x) {} // equivalent to above

But this is not:

template <typename T> struct matrix {};
template<typename T> void test2(matrix<T> x) {}
// try abbreviated form:
void abbreviated_test2(matrix<auto> x) {} // error: 'auto' not allowed in template argument

Is there a reason why? Are there plans to support more complex abbreviated function templates in the future?

0 Answers
Related