Avoid angle brackets in default template

后端 未结 3 1004
长情又很酷
长情又很酷 2020-12-16 02:37

If I have a template class with a default template type, I have to write the template angle brackets. Is it somehow possible to avoid this?

Example:

3条回答
  •  借酒劲吻你
    2020-12-16 03:16

    ... if I want to use the class ...

    This is a common source of confusion. A class template is not a class, but a template from which classes are generated. The angle brackets is what tells the compiler that you want to generate a class out of the class template with the given template arguments, without the angle brackets what you have is a template.

    template 
    struct TemplateClass {...};
    
    template