🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3912

stack template argument question

#3912
From: 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 
]
Technical Details
Message-ID: <pgpmoose.199604031648.8414@isolde.mti.sgi.com>
Path: arc1-ca.pugleaf.net!fido.asd.sgi.com!austern

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!fido.asd.sgi.com!austern
From: Michael Klobe <mklobe@objectspace.com>
Newsgroups: comp.std.c++
Subject: stack template argument question
Date: 03 Apr 1996 16:48:06 PST
Organization: -
Approved: austern@isolde.mti.sgi.com
Message-ID: <pgpmoose.199604031648.8414@isolde.mti.sgi.com>
NNTP-Posting-Host: isolde.mti.sgi.com
X-Original-Date: Wed, 3 Apr 96 18:47:43 CST
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBVAwUBMWMcR0y4NqrwXLNJAQHg1AH/X2pTywwAE2juMfpIUQSot7fTOidvweO0
 E3vld2hwZyjXnp54k5nDi7HLM++SgYoQOXxuZfkfiNpz7xVyBqcLgQ==
 =dEGT
Originator: austern@isolde.mti.sgi.com