Title
Ambiguity with string::insert()
Status
nad
Section
[string.access]
Submitter
Nico Josuttis

Created on 1998-09-29.00:00:00 last changed 171 months ago

Messages

Date: 2010-10-21.18:28:33

Rationale:

Not a defect. The LWG believes this is a "genetic misfortune" inherent in the design of string and thus not a defect in the Standard as such .

Date: 1998-09-29.00:00:00

If I try

    s.insert(0,1,' ');

  I get an nasty ambiguity. It might be

    s.insert((size_type)0,(size_type)1,(charT)' ');

which inserts 1 space character at position 0, or

    s.insert((char*)0,(size_type)1,(charT)' ')

which inserts 1 space character at iterator/address 0 (bingo!), or

    s.insert((char*)0, (InputIterator)1, (InputIterator)' ')

which normally inserts characters from iterator 1 to iterator ' '. But according to 23.1.1.9 (the "do the right thing" fix) it is equivalent to the second. However, it is still ambiguous, because of course I mean the first!

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg193
1998-09-29 00:00:00admincreate