Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1102151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:08:29+00:00 2026-05-17T01:08:29+00:00

Given a C++ template class (or function) definition: template<typename T> struct Foo { T

  • 0

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)
{ }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:08:30+00:00Added an answer on May 17, 2026 at 1:08 am

    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 More I would use camel case too.

    As for the content of what you type, it depends:

    • for small functions, I usually use the Concept name, possibly abbreviated: FwdIt for ForwardIterator for example, as a reminder of what the type should implement
    • for larger class / functions, I use either a Concept or a meaningful name (business-dependent) if possible
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given a class with a member template function like this one: template <typename t>
Given: template<class T> struct test { void foo(int b); void testFunc( int a )
Consider the following setup: I am given an interface template<class T> void FooClass<T>::foo(boost::function<double (int)>
its templates again ;-) Given the following template member functions and CRTP class: template<typename
Given the following template: template <typename T> class wrapper : public T {}; What
Given the following piece of code: template<typename T> class MyContainer { typedef T value_type;
Given: struct Field { template<class T> T Value() const { // ??? } template<class
Given: template<typename T> class A { B b; std::vector<T> vec1; std::vector<T> vec2; } I'd
c++ faq 35.16 http://www.parashift.com/c++-faq-lite/template-friends.html #include <iostream> template<typename T> class Foo { public: Foo(T const&
I have a class A: template <typename T, int I> struct A {}; and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.