@gynvael wat

i thought std::endl was a platform dependent constant??

@meena In all honesty that's what I thought as well for years! Then, when I was writing some article or something, I wanted to find the exact definition in the headers... and found a function.

After checking in the standard's draft (http://eel.is/c++draft/ostream.manip#2) it turned out that apart from this being a platform specific constant, it also does a flush() 🤷

[ostream.manip]

@gynvael why wouldn't that be a separate function??
@meena I have only my guesses, which are:
- perhaps endl is the de facto "separate function" you mention, as basically all modern platforms use \n as the end of line anyway, so there's no need for a function that emits a platform specific character (i.e. one can just include \n at the end of the string vs using the separate function which also does a flush)
- or the authors wanted to make sure that the buffer is flushed with every new line for UX purposes; this is actually in line with other places in the standard library where there is code adding a flush after each \n (e.g. stdout is line buffered by default when connected to a terminal).