Some recent addition to the language help with that. Things like "if constexpr" permit to get rid of some SFINAE, and lambdas are generally helpfull into simplifying some code.
Well, even if the syntax for lambdas is...
[&](conststd::string&some_adjective){std::cout<<"... a bit "<<some_adjective<<" sometimes ...\n";}("laborious");
(this is just an useless example of code that nobody should ever write)
And yes, this thing is the devil and should not be used. I'm sad so much books and courses about C++ use this thing as a "new line" character, it is not. It happens to print one before flushing.
std::cin and std::cout will synchronize themselves, you don't need to flush by hand, you just makes your program slower that it should be, and this tend to make me angry ;-)
We need a simpler syntax for C++ :)
We need to switch to Rust. :)
Some recent addition to the language help with that. Things like "if constexpr" permit to get rid of some SFINAE, and lambdas are generally helpfull into simplifying some code.
Well, even if the syntax for lambdas is...
(this is just an useless example of code that nobody should ever write)
;-)
Indeed. +1 for using \n instead of std::eol.
Indeed! (You probably mean
std::endl
;-))And yes, this thing is the devil and should not be used. I'm sad so much books and courses about C++ use this thing as a "new line" character, it is not. It happens to print one before flushing.
std::cin and std::cout will synchronize themselves, you don't need to flush by hand, you just makes your program slower that it should be, and this tend to make me angry ;-)
Oh yeah, I meant
std::endl
... haha I have read too much about LF and CRLF eol's these daysRemark, I wouldn't be a bad thing to have a global called "eol" or "lf" in std that doesn't flush the output. :-)
But it's really a shame that they called this thing "endl"...