Re: map allocator
"Mycroft Holmes" <m.holmes@nospam.it> wrote in message
news:ubMvZiTgJHA.4868@TK2MSFTNGP05.phx.gbl
Per 23.1.8, the last argument should be an allocator whose value
type is the same as container's value type - in this case,
pair<const double, int>.
Thanks for your answer.
So in principle, should I do this?
typedef std::map<double, int, std::less<double> >::value_type
USUAL_VALUE_TYPE;
std::map<double, int, std::less<double>,
MYALLOCATOR<USUAL_VALUE_TYPE> > m;
Well, I guess you could, but I don't see why you can't just write
std::map<double, int, std::less<double>,
MYALLOCATOR<std::pair<const double, int> > m;
After all, you obviously don't feel that you have to give the third
parameter the same treatment:
typedef std::map<double, int>::key_type USUAL_KEY_TYPE;
std::map<double, int, std::less<USUAL_KEY_TYPE> > m;
What, in your opinion, makes the allocator parameter so special?
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925