Title
std::string allocator requirements still inconsistent
Status
nad
Section
[basic.string]
Submitter
Bo Persson

Created on 2006-12-05.00:00:00 last changed 171 months ago

Messages

Date: 2010-10-21.18:28:33

[ 2009-07 Frankfurt ]

Move to NAD.

Date: 2010-10-21.18:28:33

[ post Bellevue: We re-confirm that the issue is real. Pablo will provide wording. ]

Date: 2010-10-21.18:28:33

[ Bo adds: The new container constructor which takes only a size_type is not consistent with [container.requirements], p9 which says in part: ]

All other constructors for these container types take an Allocator& argument (20.1.2), an allocator whose value type is the same as the container's value type. A copy of this argument is used for any memory allocation performed, by these constructors and by all member functions, during the lifetime of each container object.

Date: 2010-10-21.18:28:33

[ Review constructors and functions that return a string; make sure we follow these rules (substr, operator+, etc.). Howard to supply wording. ]

Date: 2010-10-21.18:28:33

[ Batavia: We need blanket statement to the effect of: ]

  1. If an allocator is passed in, use it, or,
  2. If a string is passed in, use its allocator.
Date: 2006-12-05.00:00:00

This is based on N2134, where 21.3.1/2 states: "... The Allocator object used shall be a copy of the Allocator object passed to the basic_string object's constructor or, if the constructor does not take an Allocator argument, a copy of a default-constructed Allocator object."

Section 21.3.2/1 lists two constructors:

basic_string(const basic_string<charT,traits,Allocator>& str );

basic_string(const basic_string<charT,traits,Allocator>& str ,
             size_type pos , size_type n = npos,
             const Allocator& a = Allocator());

and then says "In the first form, the Allocator value used is copied from str.get_allocator().", which isn't an option according to 21.3.1.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg3222
2010-10-21 18:28:33adminsetmessages: + msg3221
2010-10-21 18:28:33adminsetmessages: + msg3220
2010-10-21 18:28:33adminsetmessages: + msg3219
2010-10-21 18:28:33adminsetmessages: + msg3218
2006-12-05 00:00:00admincreate