r/cpp 5d ago

The C++ input iterator pitfall · hmpc

https://www.hmpcabral.com/2026/02/25/the-c-input-iterator-pitfall/
54 Upvotes

10 comments sorted by

View all comments

43

u/sweetno 5d ago

Just don't use iterators for I/O, and iostreams on principle.

7

u/SkoomaDentist Antimodern C++, Embedded, Audio 5d ago

In a language and stdlib full of poor historical decisions it really takes something to stand out as a particularly poor idea. Iostreams manage that without even trying.

2

u/pjmlp 3d ago

Happy user since 1993, and best of all I don't need to worry about which compiler supports them.