3 ms·
Why?
by edflsafoiewq 6y ago
Why?
- 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