Topic: N2369 Defect: basic_string is not a sequence
Author: bop@gmb.dk ("Bo Persson")
Date: Sun, 19 Aug 2007 01:28:31 GMT Raw View
Paragraph [basic.string]/3 states:
"The class template basic_string conforms to the requirements for a
Sequence (23.1.1) and for a Reversible Container (23.1)."
First of all, 23.1.1 is no longer "Sequence" but "Sequence container".
Secondly, after the resent changes to containers (emplace, push_back,
const_iterator parameters to insert and erase), basic_string is not
even close to conform to the current requirements.
Proposed resolution:
Remove this sentence, in recognition of the fact that basic_string is
not just a vector-light for literal types, but something quite
different, a string abstraction in its own right.
Bo Persson
---
[ 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://www.comeaucomputing.com/csc/faq.html ]
Author: jdennett@acm.org (James Dennett)
Date: Sun, 19 Aug 2007 06:44:37 GMT Raw View
Bo Persson wrote:
> Paragraph [basic.string]/3 states:
> "The class template basic_string conforms to the requirements for a
> Sequence (23.1.1) and for a Reversible Container (23.1)."
>
> First of all, 23.1.1 is no longer "Sequence" but "Sequence container".
> Secondly, after the resent changes to containers (emplace, push_back,
> const_iterator parameters to insert and erase), basic_string is not
> even close to conform to the current requirements.
>
>
> Proposed resolution:
> Remove this sentence, in recognition of the fact that basic_string is
> not just a vector-light for literal types, but something quite
> different, a string abstraction in its own right.
I would prefer to change the definition of basic_string so
that it does conform to the Sequence Container requirements.
-- James
---
[ 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://www.comeaucomputing.com/csc/faq.html ]
Author: tazmaster@rocketmail.com ("Jim Langston")
Date: Sun, 19 Aug 2007 13:09:47 GMT Raw View
"James Dennett" <jdennett@acm.org> wrote in message
news:riPxi.37353$Mu5.25226@newsfe15.phx...
> Bo Persson wrote:
>> Paragraph [basic.string]/3 states:
>> "The class template basic_string conforms to the requirements for a
>> Sequence (23.1.1) and for a Reversible Container (23.1)."
>>
>> First of all, 23.1.1 is no longer "Sequence" but "Sequence container".
>> Secondly, after the resent changes to containers (emplace, push_back,
>> const_iterator parameters to insert and erase), basic_string is not
>> even close to conform to the current requirements.
>>
>>
>> Proposed resolution:
>> Remove this sentence, in recognition of the fact that basic_string is
>> not just a vector-light for literal types, but something quite
>> different, a string abstraction in its own right.
>
> I would prefer to change the definition of basic_string so
> that it does conform to the Sequence Container requirements.
Agreed. Wouldn't it be better to give std::string push_back,
const_iterators, etc? It shouldn't be that difficult. Consider, a
push_back would be the same as MyString += 'a'; I don't really see anything
that would be difficult, since my understanding is the new standard will
give std::string the same guarantee as std::vector, that it's data is stored
in contiquous memory.
This would actually bring std::string closer to std::vector in some areas,
yet retain it's current usefullness.
---
[ 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://www.comeaucomputing.com/csc/faq.html ]
Author: bop@gmb.dk ("Bo Persson")
Date: Sun, 19 Aug 2007 13:20:12 GMT Raw View
James Dennett wrote:
:: Bo Persson wrote:
::: Paragraph [basic.string]/3 states:
::: "The class template basic_string conforms to the requirements for
::: a Sequence (23.1.1) and for a Reversible Container (23.1)."
:::
::: First of all, 23.1.1 is no longer "Sequence" but "Sequence
::: container". Secondly, after the resent changes to containers
::: (emplace, push_back, const_iterator parameters to insert and
::: erase), basic_string is not even close to conform to the current
::: requirements.
:::
:::
::: Proposed resolution:
::: Remove this sentence, in recognition of the fact that
::: basic_string is not just a vector-light for literal types, but
::: something quite different, a string abstraction in its own right.
::
:: I would prefer to change the definition of basic_string so
:: that it does conform to the Sequence Container requirements.
::
That's another option, of course. :-)
I just felt that adding emplace, for in-place construction of a char,
might be overkill. It is already difficult to teach about std::string
and its way too many member functions. Adding more of them doesn't
seem like the obvious solution to me.
Bo Persson
---
[ 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://www.comeaucomputing.com/csc/faq.html ]
Author: jdennett@acm.org (James Dennett)
Date: Mon, 20 Aug 2007 14:13:05 GMT Raw View
Bo Persson wrote:
> James Dennett wrote:
> :: Bo Persson wrote:
> ::: Paragraph [basic.string]/3 states:
> ::: "The class template basic_string conforms to the requirements for
> ::: a Sequence (23.1.1) and for a Reversible Container (23.1)."
> :::
> ::: First of all, 23.1.1 is no longer "Sequence" but "Sequence
> ::: container". Secondly, after the resent changes to containers
> ::: (emplace, push_back, const_iterator parameters to insert and
> ::: erase), basic_string is not even close to conform to the current
> ::: requirements.
> :::
> :::
> ::: Proposed resolution:
> ::: Remove this sentence, in recognition of the fact that
> ::: basic_string is not just a vector-light for literal types, but
> ::: something quite different, a string abstraction in its own right.
> ::
> :: I would prefer to change the definition of basic_string so
> :: that it does conform to the Sequence Container requirements.
> ::
>
> That's another option, of course. :-)
>
> I just felt that adding emplace, for in-place construction of a char,
> might be overkill. It is already difficult to teach about std::string
> and its way too many member functions. Adding more of them doesn't
> seem like the obvious solution to me.
However, it could *increase* simplicity by increasing uniformity;
being able to say "basic_string is a container" saves a lot of
detailed explanation (although there is of course a lot more to
say about our favorite bloated class template).
-- James
---
[ 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://www.comeaucomputing.com/csc/faq.html ]