Better names for typedefs

Just a loungy type question. Say I have two classes, Position and Object. Thus far, I've been using a naming convention such as:

using object_container = std::map< Position, Object >;

I'm not liking it. Nor can I think of anything better...

using positioned_objects = std::map< Position, Object >;

Any ideas?
Last edited on
closed account (3hM2Nwbp)
Is a typedef or using declaration necessary in this case?

Generally speaking, the only time that I've been known to use either is when dealing with template traits and policy classes (**typically, to make my own types inter-op with the standard library containers and algorithms).

Just my two cents, anyway.
Last edited on
If you're trying to come up with a naming convention for std::map<Type1, Type2>, maybe try something like:

using MapT1T2 std::map<Type1, Type2>;

In this case, it would be:
using MapPosObj = ....;

or maybe you want:
Map_PosObj;

Whatever you do, be consistent. I've noticed that your class types (Position, Object) start with a capitol, so this should start with a capitol letter as well. It's fairly common for people to precede a name with a short description of the type like: strHello (string), fHello (float), vStuff (vector).

I like to use capitols for my types, and lower-case for variables. I use m_ prefix for members, p_ prefix for parameters, g_ prefix for globals and no prefix for locals.
Topic archived. No new replies allowed.