Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-10-04 13:57:03

At 01:08 PM 10/4/2001, Peter Dimov wrote:

>From: <williamkempf_at_[hidden]>
>> > Looks like basic_string is only fwd declared at his point.
>> I'm not sure if STLPort is compliant here or not, but this causes
>> grief. The standard explicitly says that the std::exception types
>> should all take an argument of type "const string&" in their
>> constructors. The fact that the type is a reference may allow
>> implementations to only forward declare std::string here, but doing
>> so is a questionable practice as it doesn't accomplish much of
>> anything. Any code that constructs a std::exception type is going to
>> have to include <string> any way, so very few compilation units will
>> benefit from the "optimization". It won't hurt for me to include
>> <string> in <boost/thread/exceptions>, but I really question why I
>> should have to.
>Because the standard says so. If you use std::string, you have to
><string>. Other headers are not required to do it for you, even when
>interfaces mention std::string.

That's my reading too. IIRC, it is also one of the examples Andy Koenig
gives of why the current rules can lead to user confusion.

My reading of the rules is that if a standard library header requires a
definition of a type (presumably because it needs a complete type), the
appropriate standard library header has to be included by the
implementation. But if only a declaration is required (because the usage
is such an incomplete type is OK), the full header doesn't have to be


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