Given a C++ template class (or function) definition:
template<typename T>
struct Foo {
T member;
};
— if in a more complicated case I want to make the typename more expressive, what case naming conventions are accepted or shunned (and why). Examples:
template<typename MORE_EXPRESSIVE_NAME>
struct More {
MORE_EXPRESSIVE_NAME* p_;
More(MORE_EXPRESSIVE_NAME* p);
...
};
template<typename MORE_EXPRESSIVE_NAME>
More<MORE_EXPRESSIVE_NAME>::More(MORE_EXPRESSIVE_NAME* p)
: p_(p)
{ }
or
template<typename MoreExpressiveName>
struct More {
MoreExpressiveName* p_;
More(MoreExpressiveName* p);
...
};
template<typename MoreExpressiveName>
More<MORE_EXPRESSIVE_NAME>::More(MoreExpressiveName* p)
: p_(p)
{ }
or
template<typename mr_exprs_nm>
struct More {
mr_exprs_nm* p_;
More(mr_exprs_nm* p);
...
};
template<typename mr_exprs_nm>
More<mr_exprs_nm>::More(mr_exprs_nm* p)
: p_(p)
{ }
The main thing about naming convention is consistency. Whatever the convention you adopt, please keep it throughout the project, and therefore if you jump in on a project where there is already one adopted, stick to it (if there is none, rename).
That being said, ALL caps are normally reserved for macros in most of the naming conventions I have seen, so I would definitely avoid it.
I myself prefer to name template parameters like I name types or constants (depending on the kind of the parameter), for consistency. In this case, given that you use
MoreI would use camel case too.As for the content of what you type, it depends:
FwdItforForwardIteratorfor example, as a reminder of what the type should implement