🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Michael Klobe Thu, 04 Apr 1996 00:48
stack template argument question
#3912
Author: Michael Klobe
Date: Thu, 04 Apr 1996 00:48
61 lines
1986 bytes
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 
]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads