std::flush
std::endl
在我正在查看的所有遗留代码中使用a 之后。std::endl
当我第一次看到这个时,我的想法是从查看和的描述来看是多余的std::flush
:
http://en.cppreference.com/w/cpp/io/manip/endl
http://en.cppreference.com/w/cpp/io/manip/flush
这是我在遗留源代码中看到的示例:
std::cout << "Generic Notification" << std::endl << std::flush;
但是,多年来,许多高级软件开发人员都看到了这段代码,我想知道我是否遗漏了一些细节。有一个std::flush
after a有什么目的std::endl
吗?