Modify

Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#7408 closed Bugs (fixed)

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 (0)

Change History (7)

comment:1 Changed 5 years ago by viboes

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

comment:2 Changed 4 years ago by nathanridge

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

comment:3 follow-up: Changed 4 years 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 4 years ago by nathanridge

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

(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 4 years ago by nathanridge

Fixed for 1.54.

comment:6 in reply to: ↑ 3 ; follow-up: Changed 4 years 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 4 years 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.

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain neilgroves.
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.