Šimon Tóth’s Post

View profile for Šimon Tóth

C++ Educational Content Creator | 20 years of Software Engineering experience distilled into digestible daily posts

Including the <iostream> header can significantly impact compile time, as it is one of the heavy standard C++ headers. As an alternative, notably for library headers, the <iosfwd> header provides only forward declaration, making it essentially free. As long as we only need to declare stream insertion and extraction functions, the <iosfwd> header is sufficient. Compiler Explorer link: https://lnkd.in/eXi9xBBa #cpp #cplusplus #coding #programming #dailybiteofcpp

  • text
🍊 Hana Dusíková

Staff Software Engineer at Woven by Toyota, Chair of SG for Compile-Time Programming, Assistant Chair for Evolution Working Group, Czech National Body in ISO/IEC JTC1 SC22 (Programming Languages) and WG21 (C++ Committee)

2y

Thanks for doing the teaching, not many people know about <iosfwd> header in my experience. One downside of this solution is the friend operators won't be hidden and will participate in overload set for purposes of conversions. Which can lead to unforeseen conversion. https://compiler-explorer.com/z/b36Y59dhf

David Landry

Collins Aerospace214 followers

2y

Would it be more lightweight to use C stream functions with stream/file buffer pointers? Or maybe create a class with iostream-like methods and operator overrides that wrap around C stream methods.

Vishal Oza

none985 followers

2y

would modules avoid the issue all together?

Dean Turpin

Zenitel2K followers

2y

No way ☝🏻😱

Like
Reply
Evan McClure

Aerospike2K followers

2y

Nifty. Thanks.

Like
Reply
Matthias Grün

Arcadis Mobility Germany GmbH195 followers

2y

Juan Antonio Herreros Bragado

Like
Reply
See more comments

To view or add a comment, sign in

Explore content categories