Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can concepts replace all other instances of the template keyword?

Can C++ concepts be used to replace all appearances of the keyword template
(apart from the concept's own declaration)?

I'm curious if there is any reason one would still need to use the keyword template for other language constructs such as templated classes or templated functions. The only exception I can think of, are templated type aliases. Using templates for compile time calculations would be replaceable through constexpr functions.

To keep my question brief,
What can regular template declarations do, that the adoption of concepts + constexpr can't replace?

like image 522
Trevor Hickey Avatar asked Dec 24 '22 14:12

Trevor Hickey


1 Answers

template would still be required for explicit instantiations

template some_class<int>;

and disambiguating dependent member templates

obj.template fun<T>();
like image 198
TemplateRex Avatar answered Mar 29 '23 23:03

TemplateRex