From 3337565694641458153
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,cd1ac2d60a3f06
X-Google-Attributes: gidf78e5,public
From: Anders Pytte <anders@milkweed.com>
Subject: Re: What the deque?!
Date: 2000/06/30
Message-ID: <B580CAD3.6745%anders@milkweed.com>#1/1
X-Deja-AN: 640441020
Content-transfer-encoding: 7bit
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
References: <MPG.13c481aa27f926e798970c@news.supernews.com>
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
Content-Type: text/plain; charset="US-ASCII"
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Trace: mail2news.demon.co.uk 962293670 mail2news:10092 mail2news mail2news.demon.co.uk
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.02.2022
Mime-version: 1.0
NNTP-Posting-Date: Thu, 29 Jun 2000 09:44:05 EDT
Newsgroups: comp.std.c++

in article MPG.13c481aa27f926e798970c@news.supernews.com, Scott Meyers at
smeyers@aristeia.com wrote on 6/29/00 10:38 PM:

> So there I was, minding my own business, when I noticed a glazy stare aimed
> in my direction.  This was bad news, because my business of late is
> explaing the STL to professional C++ programmers, and a glazy stare is a
> sign of a confused programmer.  In particular, a programmer who wanted to
> know what one would naturally use a deque for -- why the standard raises
> the comparatively obscure deque up to the heights of a vector, list, and
> string.  It was a good question, and I didn't have a good answer for it.

[snip]

> I can describe deque's behavior and technical strengths/weaknesses until
> the ruminants come home, but that's not what I need.  What I need are some
> plausible examples of problems where a deque's behavior, strengths, and
> weaknesses are a better match for the problems than are the other standard
> containers or container adapters.

I think you are being coy, and that the following justification for deque is
well know. Symmetry and completeness!

A queue is so useful, but practically just a special case of deque, it is
hard to imagine designing a template library that includes queue but not
deque.

(Yes, practically: it is hard to implement a container that efficiently
pushes at an end that does not also efficiently pop at that end).

Thus every application of queue is also an application of deque (granted,
other sequences could be used in place of deque to implement queue).

Even so, I get your point: it is surprising that there are so few
applications where one wants to push and pop at both ends.

Anders.

-- 
Anders Pytte                                   Milkweed Software
PO Box 32                                  voice: (802) 586-2545
Craftsbury, VT 05826                  email: anders@milkweed.com

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]




