|
Boost : |
From: Paul Hollingsworth (boost_at_[hidden])
Date: 2000-10-05 11:32:27
Thanks Darin.
In any case, even if you could do what I suggested, it would possibly
(depending on how std::vector is implemented) induce code-bloat as you're
basically creating different "copies" of std::vector.
Paul Hollingsworth
http://PaulHollingsworth.com
-----Original Message-----
From: Darin Adler [mailto:darin_at_[hidden]]
Sent: Thursday, October 05, 2000 11:12 AM
To: boost_at_[hidden]
Subject: Re: [boost] Isolating dependencies in header files
on 10/5/00 8:47 AM, Paul Hollingsworth at boost_at_[hidden] wrote:
> One solution I thought might work would be:
>
> namespace impl {
> #include <vector>
> }
>
>
> That is, according to the ANSI/ISO standard, should you be able to use
this
> trick?
Absolutely not.
The specific language in the ISO standard is "A translation unit shall
include a header only outside of any external declaration or definition,
[...]" (17.4.2.1/3). The code above includes the header inside a namespace
definition.
> So, are there any other cool tricks that can be brought to bear on this
> problem?
The standard is specifically designed so that including any one standard
header is allowed to pull in all the rest of the standard headers. I don't
know of any tricks to get around this for programmers who want to write
standard code, although I could imagine a compiler/library implementer
making a feature that would enforce some kind of programming rule like this.
-- Darin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk