Modify

Ticket #7408 (closed Bugs: fixed)

Opened 19 months ago

Last modified 10 months ago

istream_range should not pull istream

Reported by: Christopher Yeleighton <giecrilj@…> Owned by: neilgroves
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.

Attachments

Change History

comment:1 Changed 19 months ago by viboes

  • Owner set to neilgroves
  • Version changed from Boost 1.52.0 to Boost 1.51.0
  • Component changed from None to range

comment:2 Changed 11 months ago by nathanridge

(In [84644]) [range] Don't include <istream> unnecessarily in istream_range.hpp (refs #7408).

comment:3 follow-up: ↓ 6 Changed 11 months ago by 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>.

comment:4 Changed 10 months ago by nathanridge

  • Status changed from new to closed
  • Resolution set to fixed

(In [84823]) [range] Merge Boost.Range bug fixes to release branch (fixes #6944; fixes #7407; fixes #7408; fixes #7731; fixes #7827; fixes #8338; fixes #8453).

comment:5 Changed 10 months ago by nathanridge

Fixed for 1.54.

comment:6 in reply to: ↑ 3 ; follow-up: ↓ 7 Changed 10 months ago by 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!)

comment:7 in reply to: ↑ 6 Changed 10 months ago by nathanridge

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.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.