Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exported template parameters of classes and structs should be postfixed with an underscore #572

Open
eggrobin opened this issue Jun 7, 2015 · 1 comment

Comments

@eggrobin
Copy link
Member

eggrobin commented Jun 7, 2015

Considering that template parameters of a class or struct cannot be accessed outside of it,
that accessors for template parameters are therefore useful, that these accessors cannot bear the same name as the template parameters (14.6.1, paragraph 6),

considering that a similar issue exists with private member variables, that we resolve it (following the Google C++ styleguide) by appending an underscore to the name of such variables,

considering that the other reasonable alternative, CamelCase prefixed by the letter k, used for compile-time constants of global or class scope, would hamper readability,

considering that underscores postfixing every template parameter would further impede readability of already abstruse template metaprogramming,

for these reasons,

the following naming convention shall be implemented for template parameters:

  • NonExportedTypeTemplateParameter;
  • non_exported_non_type_template_parameter;
  • ExportedTypeTemplateParameter_,
    exported by using ExportedTypeTemplateParameter = ExportedTypeTemplateParameter_;
  • exported_non_type_template_parameter_, exported by static T const exported_non_type_template_parameter = exported_non_type_template_parameter_;.
@pleroy
Copy link
Member

pleroy commented Sep 30, 2020

Also, let's use typename, not class, for the template template parameters.

Sorry, something went wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants