Skip to content

Commit f691899

Browse files
committed
P0753R2 Manipulators for C++ Synchronized Buffered Ostream
1 parent a21841f commit f691899

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

source/iostreams.tex

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4105,6 +4105,13 @@
41054105
template<class charT, class traits>
41064106
basic_ostream<charT, traits>& flush(basic_ostream<charT, traits>& os);
41074107

4108+
template<class charT, class traits>
4109+
basic_ostream<charT, traits>& emit_on_flush(basic_ostream<charT, traits>& os);
4110+
template<class charT, class traits>
4111+
basic_ostream<charT, traits>& noemit_on_flush(basic_ostream<charT, traits>& os);
4112+
template<class charT, class traits>
4113+
basic_ostream<charT, traits>& flush_emit(basic_ostream<charT, traits>& os);
4114+
41084115
template<class charT, class traits, class T>
41094116
basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>&& os, const T& x);
41104117
}
@@ -6677,6 +6684,69 @@
66776684
\tcode{os}.
66786685
\end{itemdescr}
66796686

6687+
\indexlibrary{\idxcode{emit_on_flush}}%
6688+
\begin{itemdecl}
6689+
template<class charT, class traits>
6690+
basic_ostream<charT, traits>& emit_on_flush(basic_ostream<charT, traits>& os);
6691+
\end{itemdecl}
6692+
6693+
\begin{itemdescr}
6694+
\pnum
6695+
\effects
6696+
If \tcode{os.rdbuf()} is a
6697+
\tcode{basic_osyncbuf<charT, traits, Allocator>*} \tcode{buf},
6698+
calls \tcode{buf->set_emit_on_sync(true)}.
6699+
Otherwise this manipulator has no effect.
6700+
\begin{note}
6701+
To work around the issue that the
6702+
\tcode{Allocator} template argument can not be deduced,
6703+
implementations can introduce an intermediate base class
6704+
to \tcode{basic_osyncbuf} that manages its \tcode{emit_on_sync} flag.
6705+
\end{note}
6706+
6707+
\pnum
6708+
\returns
6709+
\tcode{os}.
6710+
\end{itemdescr}
6711+
6712+
\indexlibrary{\idxcode{noemit_on_flush}}%
6713+
\begin{itemdecl}
6714+
template<class charT, class traits>
6715+
basic_ostream<charT, traits>& noemit_on_flush(basic_ostream<charT, traits>& os);
6716+
\end{itemdecl}
6717+
6718+
\begin{itemdescr}
6719+
\pnum
6720+
\effects
6721+
If \tcode{os.rdbuf()} is a
6722+
\tcode{basic_osyncbuf<charT, traits, Allocator>*} \tcode{buf},
6723+
calls \tcode{buf->set_emit_on_sync(false)}.
6724+
Otherwise this manipulator has no effect.
6725+
6726+
\pnum
6727+
\returns
6728+
\tcode{os}.
6729+
\end{itemdescr}
6730+
6731+
\indexlibrary{\idxcode{flush_emit}}%
6732+
\begin{itemdecl}
6733+
template<class charT, class traits>
6734+
basic_ostream<charT, traits>& flush_emit(basic_ostream<charT, traits>& os);
6735+
\end{itemdecl}
6736+
6737+
\begin{itemdescr}
6738+
\pnum
6739+
\effects
6740+
\tcode{os.flush()}.
6741+
Then, if \tcode{os.rdbuf()} is a
6742+
\tcode{basic_osyncbuf<charT, traits, Allocator>*} \tcode{buf},
6743+
calls \tcode{buf->emit()}.
6744+
6745+
\pnum
6746+
\returns
6747+
\tcode{os}.
6748+
\end{itemdescr}
6749+
66806750
\rSec3[ostream.rvalue]{Rvalue stream insertion}
66816751

66826752
\indexlibrarymember{operator<<}{basic_ostream}%
@@ -9967,6 +10037,8 @@
996710037
\indexlibrary{\idxcode{osyncstream}}%
996810038
\indexlibrary{\idxcode{wosyncstream}}%
996910039
\begin{codeblock}
10040+
#include <ostream> // see \ref{ostream.syn}
10041+
997010042
namespace std {
997110043
template<class charT, class traits, class Allocator>
997210044
class basic_syncbuf;

0 commit comments

Comments
 (0)