std::map
definition is copied below:
template<
class Key,
class T,
class Compare = std::less<Key>,
class Allocator = std::allocator<std::pair<const Key, T> >
> class map;
Based on std::map
definition, we can provider customized allocator for its Key and Value.
Questions:
- In most situations,
std::map
is implemented by RB tree. How can we provide customized allocator for RB tree node? I am afraid that we can not do it. - If the answer to the first question is that we can NOT provide customized allocator for RB tree node, we can NOT provide customized allocator for other node-based containers (for example,
std::lis
t andstd::set
), either. Please confirm if my understanding is correct.