Container allocator_type

B

Barry Ding

As I check sig and Dinkumware STL implementation

Containers like deque ,vector and list

template <class T, class A = allocator<T> >
class XContainer : public XContainer_base<T, A> {
typedef XContainer_base::allocator allocator_type;
};

sgi doesn't rebind, so the XContainer_base::allocator == A (the
template parameter)
Dinkumware do rebind, but still rebind to T type
both equal to A if default

so the question is why trying so hard to do this, why not just
typdef A allocator_type?
 
B

Bo Persson

Barry Ding wrote:
:: As I check sig and Dinkumware STL implementation
::
:: Containers like deque ,vector and list
::
:: template <class T, class A = allocator<T> >
:: class XContainer : public XContainer_base<T, A> {
:: typedef XContainer_base::allocator allocator_type;
:: };
::
:: sgi doesn't rebind, so the XContainer_base::allocator == A (the
:: template parameter)
:: Dinkumware do rebind, but still rebind to T type
:: both equal to A if default
::
:: so the question is why trying so hard to do this, why not just
:: typdef A allocator_type?

To protect yourself against XContainer<T, allocator<U> >.


Bo Persson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,291
Messages
2,571,453
Members
48,137
Latest member
IndiraMcCo

Latest Threads

Top