Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-10-06 09:46:23


From: "Howard Hinnant" <hinnant_at_[hidden]>
> > If you explicitly use a standard defined name, then you must explicitly
> > include the associated header. Otherwise you do not have to include
> > the header, even if you are implicitly referring to said object.
>
> Of course the above "rule" would have to be encoded in standard-eze so
> that only high priests are capable of interpreting its true meaning. ;-)
>
> Under this rule, Beman's example would be conforming because it only
> implicitly refers to std::string, not explicitly. Thus #include
> <string> is not necessary. If the example were changed to:
>
> lock_error() : std::runtime_error(std::string("thread lock
> error")) { }
>
> then #include <string> becomes necessary.

What is the difference between the two examples? You can't add a char const*
overload without breaking code AFAICS.

struct X
{
    operator std::string () const;
    operator char const* () const;
};

std::runtime_error(X());

--
Peter Dimov
Multi Media Ltd.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk