Naming Conventions for C++ Templates



Hello,

I'm writing a C++ application with gtkmm, and I've been wondering how I
should name template parameters for class templates.

Example of problem: I have a class with template parameter called Data
and I also want to define a typedef from it, called Data too. But it's
illegal to use the same name.

The best I've come up with it to prepend T, e.g. TData, TIterator, THash
and so on, but I never see such names in API references of the libraries
I use.

Actually, the name itself doesn't matter. Maybe I won't mind calling it
TData if Doxygen automatically changes it to Data so that API readers
won't have to see the extra T there.

Prepending an underscore is common in libstdc++ but these names are
reserved to the system.

What would be the best convention/advice which will keep my code
consistent with Gnome coding conventions? (using T is not an option
because I want to have descriptive names)

- Anatoly Krasner



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]