(C++) operator<<
February 24, 2017 · View on GitHub
(C++) operator<<
operator<< (pronounced as 'stream out operator') is an operator to sending data to a stream. Use operator>> to read data from a stream.
Examples
Advice
- Prefer overloading operator<< with a free function [1]
- Note to self: prefer overloading operator<< over a 'ToStr' member function, because a stream can be more flexibly manipulated (consider streaming a std::setprecision before streaming a class instance
References
- Herb Sutter. Exceptional C++. ISBN: 0-201-61562-2.