Re: PRF & PLR flags max 32?

From: Daniel A. Koepke (dkoepke@circlemud.org)
Date: 01/26/02


On Fri, 25 Jan 2002, Henrik Stuart wrote:

>   std::vector<bool> is not deprecated, nor is it on the way out, nor
>   is it a container, std::vector is.

I didn't say it was deprecated and my point was that it wasn't a container
(and that's a *bad* thing).  As for if it's on its way out, see C++
Standard Library Active List item #96 and the Redmond proceedings.  The
Library Working Group appears to disagree with your assertion.

>   Now, the benefit of std::vector<bool> over std::bitset<size> is that
>   the vector is resizable during run-time.

This is very true; I didn't mean to (and don't believe I did) imply that
std::bitset<N> replaces std::vector<bool>.  std::vector<bool>, in fact,
replaced bitstring when the STL became part of Standard C++.  This was an
unwise decision.  Violating a user's expectations is a bad thing, which is
precisely what std::vector<bool> does (aside from it contradicting the
standard).  Special cases like this are language warts and make the
programmer's job that much more difficult.

>   std::vector<bool> can be used like any other template container with
>   random access iterators, which merely stores booleans in an
>   effective manner.

Random-access iterators MUST yield a T& on dereference.  You should find
that, in fact, std::vector<bool>::iterator does NOT do this.  A simple
verification is possible using RTTI, if you so desire.

-dak

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT