Boost logo

Boost :

Subject: Re: [boost] Boost.Algorithm design question
From: Olaf van der Spek (ml_at_[hidden])
Date: 2011-11-02 13:54:27

On Wed, Nov 2, 2011 at 4:48 PM, Nevin Liber <nevin_at_[hidden]> wrote:
> We tend to be imprecise with (or just plain leave out) those
> preconditions.  Take you example of string and const char*; the
> following asserts will either sometimes fire or invoke undefined
> behavior for a given std::string s, const char* p, or string literal
> l:
> assert(s == s.c_str());
> assert(std::string(p) == p);
> assert(std::string(l, sizeof(l) - 1) == l);

For what values does this fail? Isn't the operator== with std::string
and const char* well defined?


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