Re: [C++] Initialization lists with array

From: James Dennett (jdennett_at_acm.org)
Date: 04/01/04


Date: Wed, 31 Mar 2004 20:39:20 -0800

Chris ( Val ) wrote:

> "Gary Labowitz" <glabowitz@comcast.net> wrote in message
> news:hO2dnfdXrrh1Iv7dRVn-hA@comcast.com...
> | "Chris ( Val )" <chrisval@bigpond.com.au> wrote in message
> | news:c3rv7m$2bvs7r$1@ID-110726.news.uni-berlin.de...
> | >
> |
> | > In essence, just because we can apply an algorithms to the
> | > std::string class, does not mean that we should call it a
> | > container class. Btw(please correct me if I'm wrong), but I
> | > had thought that the std::string class had already been written,
> | > prior to the adoption of the STL by the committee ?
> |
> | But it does container a sequence of char's. Doesn't that make it a container
> | candidate?
>
> Yes, it does container a sequence of char's, but so does a
> standard character array, of which algorithms can be applied
> to as well.

But an array lacks begin() and end(), so it's not a
container in the sense of the C++ standard. It also
fails to have a nested size_type member, and plenty
of other things. std::string has them, no?

-- James



Relevant Pages

  • Re: How to avoid CMapStringToPtr sorting ?
    ... Is there any way to retrieve the keys in same order of insertion. ... The sequence of retrieved elements is indeterminate.' ... You can look up objects in a sequential container. ... MyObj obj; ...
    (microsoft.public.vc.mfc)
  • Re: Order in the STL set?
    ... > I'd like to use a set as a container for my user defined objects. ... to have the elements accessible in a sorted order, ... Wouldn't a sequence container do what you need? ... static int control; ...
    (alt.comp.lang.learn.c-cpp)
  • Re: OO Style with Ada Containers
    ... but can serve as a sequence generator. ... An iterator always has a container behind. ... If you generate just a sequence, where do you know the mapping of the ...
    (comp.lang.ada)
  • Re: OO Style with Ada Containers
    ... An iterator always has a container behind. ... If you generate just a sequence, where do you know the mapping of the ... It is an ordered set of elements. ...
    (comp.lang.ada)
  • Re: [C++] Initialization lists with array
    ... |> | But it does container a sequence of char's. ... Doesn't that make it a container ... | container in the sense of the C++ standard. ... Chris Val ...
    (alt.comp.lang.learn.c-cpp)