incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anton Pevtsov" <>
Subject RE: test for lib.string.access
Date Sat, 06 May 2006 15:18:46 GMT
The ported test is here:

Anton Pevtsov

-----Original Message-----
From: Anton Pevtsov [] 
Sent: Thursday, May 04, 2006 18:13
Subject: test for lib.string.access

I am porting the test for lib.string.access methods (operator[] and at)
and found one issue.

The code 

#include <string>

int main (void)
    std::string s ("a", 1);
    const char& c = s[1];

    return 0;

results in assertion and fails. But the standard says for 
const_reference operator[] (size_type pos) const:

"If pos < size() returns data()[pos]. Otherwise, if pos == size(), the
const version returns charT(). Otherwise, the behavior is undefined."

So I expect charT() without any asserts.

What do you think about this?

Anton Pevtsov.

View raw message