Boost logo

Boost :

From: williamkempf_at_[hidden]
Date: 2001-10-04 14:35:51


--- In boost_at_y..., Beman Dawes <bdawes_at_a...> wrote:
> At 03:06 PM 10/4/2001, Peter Dimov wrote:
>
> >From: "Beman Dawes" <bdawes_at_a...>
> >> 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
> >> included.
> >
> >I think that the rules are even stricter than that. When a
standard
> header
> >uses std::string (as a complete type), for example, this most
probably
> >means that std::string has been defined (although I don't think
that even
> >that is guaranteed. ;-) )
> >
> >However this doesn't mean that <string> has been included, or
that the
> >definitions of the templated std::string members are visible.
>
> I'm basic my reading on the footnote for 17.4.4.1 paragraph 1,
which says
> "C++ headers must include a C++ header that contains any needed
definition
> (3.2)."
>
> >Mostly academic, of course.
>
> Yes. For users, the rule is simple: If you use a name from the
standard
> library, always include a standard library header documented as
providing
> that name. Never assume some other standard library header will
include it
> for you.

There's the rub, though. I never used "a name from the standard
library" for which I did not "include a standard library header
documented as providing that name". The issue actually stems from
calling the constructors with const char* parameters which need to be
implicitly cast to the const std::string& type. So I guess you could
turn this around and claim that the standard has a defect in design,
but I don't care to go that far. I honestly think this is a QoI
issue with STLPort.

Bill Kempf


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