Boost logo

Boost :

Subject: Re: [boost] RFC: interest in Unicode codecs?
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2009-07-21 07:38:29

Phil Endecott wrote:
> Eric Niebler wrote:
>> I believe that as of C++03, std::string is required to have
>> contiguous storage. The null-termination is another thing. The only
>> guarantee is that the char* returned by c_str() is required to be
>> null terminated. No such guarantee is made for the sequence traversed
>> by std::string's iterators. Dereferencing the end iterator is verboten.
> Here is an outline of a zero-overhead wrapper for std::string that I
> hope guarantees that *end() == 0:
> struct string_with_zero_beyond_end: std::string {
> typedef const char* const_iterator;
> const_iterator begin() const { return c_str(); }
> const_iterator end() const { return c_str() + length(); }
> };
Not zero-overhead if the string implementation is one (of the
non-existent ones) that doesn't store the NUL internally.


Boost list run by bdawes at, gregod at, cpdaniel at, john at