Topic: stack template argument question


Author: Michael Klobe <mklobe@objectspace.com>
Date: 1996/04/03
Raw View
The definition of stack as I understand it is this:

namespace std
  {
  template
    <
    class T,
    class Container = deque< T >,
    class Allocator = allocator
    >
  class stack;
  }

Given this, for what is the Allocator parameter used?  It won't be a
part of the Container type, and stack itself doesn't make any use of
Allocators.  The other sequence adapters (adaptors?) have the same
semantics.  It seems like what you would really want is something
like this:

namespace std
  {
  template
    <
    class T,
    class Allocator = allocator,
    class Container = deque< T, Allocator >
    >
  class stack;
  }

or even:

namespace std
  {
  template
    <
    class T,
    class Container = deque< T >
    >
  class stack
    {
    public:
      // ... lots of definitions
      typedef Container::allocator_type allocator_type;
    };
  }

What am I missing?

-mck
   _
 _| ~~.  Michael Klobe
 \,  _}  mklobe@objectspace.com
   \(    Texas Fight!
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]