help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ / multiple instances / iostreams


From: Detlef Vollmann
Subject: Re: C++ / multiple instances / iostreams
Date: Sat, 24 Jul 2004 23:28:09 +0200

Hans Aberg wrote:
> At 16:49 +0200 2004/07/24, Detlef Vollmann wrote:
> >Ah, I see.  I use std::deque, which doesn't do re-allocation on
> >expanding but links new chunks to existing ones when growing.
> 
> Some implementations may do so, but mine does not. (Typically, a deque just
> uses an array chunk where the location arithmetic wraps around the edges.)
23.2.1.3p1 explicitely requires that no references to elements
in a deque are invalidated on an insert at the end or beginning.
This effectively forbids reallocation.
If your implementation of a deque does reallocation on an
insert, its non-conforming.

> And, if you so want, you could do it on std::vector as well. The C++
> standard just gives time limiting complexities, but does not explicitly say
> what implementation to use.
23.2.4p1 requires "The elements of a vector are stored contiguously",
this effectively requires reallocation if the vector needs to grow.

> 
> >It doesn't do automatic shrinking but I think that isn't a wise
> >thing to do anyway.
> 
> Whether it shrinks depends on the implementation. Whether is is wise
> depends on the application.
True.

Detlef

-- 
Detlef Vollmann   vollmann engineering gmbh
Linux and C++ for Embedded Systems    http://www.vollmann.ch/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]