Hello,
I am attempting to design a class:
class C {
std::map ma;
std::map ma;
.
public:
C(...);
};
The keys in the 2 maps are always identical. So I could choose:
std::map >
or
std::map* >
(ps: AFAIK, using a const-ref for the pair is impossible, but possible with
some boost classes)
Q1:
Is there a difference in memory usage, in access speed or in code
readability
between the top choice and bottom ones?
Q2:
Between the 2 bottom ones (storing the pair object in the map vs storing the
ptr)
Q3:
For users of class C, what sort of constructors should I offer?
C::C(const std::map* >& )
Or, should I allow adding elements to the map after the object being
constructed?
C::add(double, const A&, const B&)
Are there better ways with boost classes?
Thank you for boost and your time,
Rds,