If it is in your class only, I usually put it at the top of the private section:
class Foo
{
public:
void some_functions(void);
private:
typedef std::pair<std::string, std::string> StringPair;
typedef std::map<StringPair, std::string> StringPairMap;
StringPairMap _stringMap;
}
To clarify, as with most things you want to specify these things as local as possible. Variables should do this: you don't define int i
for your for-loop until you've reached the loop, etc..
Likewise, if your class uses these typedef's internally, do what I said above. If only a specific function in your class needs that typedef, place the typedef at the beginning of that function.
If you need to expose this typedef to clients of the class, I like to place the typedef's at the top of the public
section.