3 ms·
To be honest, I don't like the << operator either. I doubt I'll like the (optional) use of | for ranges too.
by secondcoming 6y ago
To be honest, I don't like the << operator either. I doubt I'll like the (optional) use of | for ranges too.
- mhh__ 6y ago<< was necessary at the time
- edflsafoiewq 6y agoWhy?
- mhh__ 6y agoC++ didn't have variadic templates so passing along a stream with an operator was more ergonomic enough and typesafe.
- edflsafoiewq 6y agoI suppose you're comparing against std::format, but the question is why overloading an operator (cout << "foo") would have been necessary vs a regular member function (cout.put("foo")).
- mhh__ 6y agoBecause it had to replace people using a comma inside printf. The member function could only accept one argument cleanly so you would've to chain them like cout.put.put.put