Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c++ > #604

Re: Sequence container capacity after calling clear()

From Daniel Krügler <daniel.kruegler@googlemail.com>
Newsgroups comp.std.c++
Subject Re: Sequence container capacity after calling clear()
Date 2013-03-23 22:05 -0700
Organization A noiseless patient Spider
Message-ID <kila1d$8u5$1@dont-email.me> (permalink)
References <dZydnUi3X6YIOtHMnZ2dnUVZ8iCdnZ2d@giganews.com>

Show all headers | View raw


Am 23.03.2013 23:27, schrieb Leigh Johnston:
>
>
> Can we please change the ISO C++ Standard so that explicitly states what
> happens to a sequence container's capacity() after calling clear()?
>
> Currently the behaviour is unspecified and I know of at least one
> implementation that deallocates on vector<T>::clear().
>
> If the behaviour remains unspecified then it is effectively impossible
> to write portable code that uses clear() and you have to hope things
> such as v.erase(v.begin(), v.end()) behave more consistently across
> different implementations.


This problem was already cause of a previous library issue:

http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#1102

Please provide this link to the vendor of the buggy library you have in mind.

HTH & Greetings from Bremen,

Daniel Krügler



--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]

Back to comp.std.c++ | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Sequence container capacity after calling clear() Leigh Johnston <leigh@i42.co.uk> - 2013-03-23 16:27 -0600
  Re: Sequence container capacity after calling clear() Daniel Krügler <daniel.kruegler@googlemail.com> - 2013-03-23 22:05 -0700
    Re: Sequence container capacity after calling clear() James Kanze <james.kanze@googlemail.com> - 2013-03-27 13:28 -0600
  Re: Sequence container capacity after calling clear() Jason McKesson <jmckesson@googlemail.com> - 2013-03-23 22:05 -0700
  Re: Sequence container capacity after calling clear() Juha Nieminen <nospam@thanks.invalid> - 2013-03-24 23:36 -0700
  Re: Sequence container capacity after calling clear() Mathias Gaunard <loufoque@googlemail.com> - 2013-03-25 10:49 -0600
    Re: Sequence container capacity after calling clear() Leigh Johnston <leigh@i42.co.uk> - 2013-03-26 08:55 -0600

csiph-web