I've always had the idea that std::map is quite a 'big' class |
You have an engineering decision to make. There is a right answer, and unless your "idea" is actually objective fact (e.g., instantiation Y greatly increases code size on implementation X), it should probably be set aside.
You need to consciously answer these questions, then decide:
- What does std::map offer your program?
- What does std::map cost your program?
The costs may be minor or even irrelevant. But this isn't necessarily true.
What about the benefits? Will it make your code more readable, or reduce the likelihood of an error?
The rule-of-thumb is "prefer solutions in the standard library".
There are parts of any given program that need to be designed with more care - interfaces, for example, deserve more care in their high-level design than the localized guts of one particular function. Implementations are easy to change, but interfaces are not. Is this decision worth the time you're taking on it?