Respect and minimize tie/flush in from/to_stream

* Save/restore tie, setting it to nullptr during the operation
* On construction tie_->flush()
* For ostreams only, flush if unitbuf
This commit is contained in:
Howard Hinnant
2018-04-18 21:47:15 -04:00
parent d53db7a1cb
commit 973bd393bc
3 changed files with 68 additions and 40 deletions
+3 -3
View File
@@ -1224,7 +1224,7 @@ detail::operator<<(std::ostream& os, const Rule& r)
{
using namespace date;
using namespace std::chrono;
detail::save_stream<char> _(os);
detail::save_ostream<char> _(os);
os.fill(' ');
os.flags(std::ios::dec | std::ios::left);
os.width(15);
@@ -2541,7 +2541,7 @@ operator<<(std::ostream& os, const time_zone& z)
{
using namespace date;
using namespace std::chrono;
detail::save_stream<char> _(os);
detail::save_ostream<char> _(os);
os.fill(' ');
os.flags(std::ios::dec | std::ios::left);
std::call_once(*z.adjusted_,
@@ -2715,7 +2715,7 @@ std::ostream&
operator<<(std::ostream& os, const link& x)
{
using namespace date;
detail::save_stream<char> _(os);
detail::save_ostream<char> _(os);
os.fill(' ');
os.flags(std::ios::dec | std::ios::left);
os.width(35);