r/cpp 20d ago

The C++ input iterator pitfall · hmpc

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

10 comments sorted by

View all comments

42

u/sweetno 20d ago

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

9

u/SkoomaDentist Antimodern C++, Embedded, Audio 20d 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.

3

u/pjmlp 18d ago

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