#7408 closed Bugs (fixed)
istream_range should not pull istream
Reported by: | Owned by: | Neil Groves | |
---|---|---|---|
Milestone: | To Be Determined | Component: | range |
Version: | Boost 1.51.0 | Severity: | Optimization |
Keywords: | Cc: |
Description
To minimize the time you have to wait on the compiler, it is good to only #include the headers you really need. istream_range.hpp simply #includes <istream> when it does not need to — and that can penalize the runtime as well.
<iosfwd> should be #included whenever you simply need the name of an I/O-related class, such as "basic_istream". Like the name implies, these are forward declarations.
Change History (7)
comment:1 by , 10 years ago
Component: | None → range |
---|---|
Owner: | set to |
Version: | Boost 1.52.0 → Boost 1.51.0 |
comment:2 by , 9 years ago
follow-up: 6 comment:3 by , 9 years ago
Fixed in trunk. However, I'm not convinced that this accomplishes anything, as istream_range.hpp includes <iterator> to use istream_iterator, and <iterator> most likely needs to bring in <istream> to properly define istream_iterator (since it's a template class so its methods need to be defined in the header). libstdc++'s <iterator>, for example, brings in <istream>.
comment:4 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
follow-up: 7 comment:6 by , 9 years ago
Replying to nathanridge:
Fixed in trunk. However, I'm not convinced that this accomplishes anything, as istream_range.hpp includes <iterator> to use istream_iterator, and <iterator> most likely needs to bring in <istream> to properly define istream_iterator (since it's a template class so its methods need to be defined in the header). libstdc++'s <iterator>, for example, brings in <istream>.
#include <iterator> void foo (::std ::wistream & = ::std ::wcin);
error: ‘wcin’ is not a member of ‘std’ (good!)
comment:7 by , 9 years ago
Replying to ne01026@…:
Replying to nathanridge:
Fixed in trunk. However, I'm not convinced that this accomplishes anything, as istream_range.hpp includes <iterator> to use istream_iterator, and <iterator> most likely needs to bring in <istream> to properly define istream_iterator (since it's a template class so its methods need to be defined in the header). libstdc++'s <iterator>, for example, brings in <istream>.
#include <iterator> void foo (::std ::wistream & = ::std ::wcin);error: ‘wcin’ is not a member of ‘std’ (good!)
That would be because 'wcin' is defined in <iostream>, not <istream>, and <iterator> doesn't bring in <iostream>, only <istream>. istream_range.hpp has never brought in <iostream>, either, so I don't see how this is relevant.
(In [84644]) [range] Don't include <istream> unnecessarily in istream_range.hpp (refs #7408).