Files
hustoj/web/cppreference-zh/chmhelp/cpp-io-basic_syncbuf-basic_syncbuf.html
2025-08-01 12:57:54 +08:00

117 lines
8.0 KiB
HTML

<!DOCTYPE html>
<html lang="zh" dir="ltr" class="client-nojs" xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh">
<head><meta http-equiv="x-ua-compatible" content="ie=edge">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>std::basic_syncbuf&lt;CharT,Traits,Allocator&gt;::basic_syncbuf</title>
<link rel="stylesheet" href="ext.css" />
<link rel="stylesheet" href="site_modules.css" />
</head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-cpp_io_basic_syncbuf_basic_syncbuf skin-cppreference2 action-view cpp-navbar">
<div id="cpp-content-base">
<div id="content"><a id="top"></a>
<h1 id="firstHeading" class="firstHeading"><span style="font-size:0.7em; line-height:130%">std::basic_syncbuf&lt;CharT,Traits,Allocator&gt;::</span>basic_syncbuf</h1>
<div id="bodyContent">
<div id="contentSub"><span class="subpages">&lt; <a href="cpp.html">cpp</a>&lrm; | <a href="cpp-io.html">io</a>&lrm; | <a href="cpp-io-basic_syncbuf.html">basic syncbuf</a></span></div>
<div id="mw-content-text" lang="zh" dir="ltr" class="mw-content-ltr" xml:lang="zh">
<table class="t-dcl-begin">
<tbody>
<tr class="t-dcl">
<td>
<div><span class="mw-geshi cpp source-cpp">basic_syncbuf<span class="br0">(</span><span class="br0">)</span><br />
&nbsp; &nbsp; <span class="sy4">:</span> basic_syncbuf<span class="br0">(</span>nullptr<span class="br0">)</span></span></div>
</td>
<td>(1)</td>
<td class="t-dcl-nopad"></td>
</tr>
<tr class="t-dcl">
<td>
<div><span class="mw-geshi cpp source-cpp"><span class="kw1">explicit</span> basic_syncbuf<span class="br0">(</span> streambuf_type<span class="sy2">*</span> obuf <span class="br0">)</span><br />
&nbsp; &nbsp; <span class="sy4">:</span> basic_syncbuf<span class="br0">(</span> obuf, Allocator<span class="br0">(</span><span class="br0">)</span> <span class="br0">)</span> <span class="br0">{</span><span class="br0">}</span></span></div>
</td>
<td>(2)</td>
<td class="t-dcl-nopad"></td>
</tr>
<tr class="t-dcl">
<td>
<div><span class="mw-geshi cpp source-cpp">basic_syncbuf<span class="br0">(</span> streambuf_type<span class="sy2">*</span> obuf, <span class="kw4">const</span> Allocator<span class="sy3">&amp;</span> a<span class="br0">)</span><span class="sy4">;</span></span></div>
</td>
<td>(3)</td>
<td class="t-dcl-nopad"></td>
</tr>
<tr class="t-dcl">
<td>
<div><span class="mw-geshi cpp source-cpp">basic_syncbuf<span class="br0">(</span> basic_syncbuf<span class="sy3">&amp;&amp;</span> rhs<span class="br0">)</span><span class="sy4">;</span></span></div>
</td>
<td>(4)</td>
<td class="t-dcl-nopad"></td>
</tr>
<tr class="t-dcl-sep">
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<div class="t-li1"><span class="t-li">1)</span> &#40664;&#35748;&#26500;&#36896;&#20989;&#25968;&#65306;&#21019;&#24314; <code>std::basic_syncbuf</code> &#30340;&#23454;&#20363;&#65292;&#23558;&#20854;&#21516;&#27493;&#26102;&#21457;&#29983;&#65288; emit-on-sync &#65289;&#31574;&#30053;&#35774;&#20026; <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw2">false</span></span></span> &#65292;&#34987;&#21253;&#35013;&#27969;&#32531;&#20914;&#35774;&#20026; <span class="t-c"><span class="mw-geshi cpp source-cpp">nullptr</span></span> &#65292;&#24182;&#20197;&#40664;&#35748;&#26500;&#36896;&#30340; <code>Allocator</code> &#20026;&#20020;&#26102;&#23384;&#20648;&#30340;&#20998;&#37197;&#22120;&#12290;</div>
<div class="t-li1"><span class="t-li">2,3)</span> &#21019;&#24314; <code>std::basic_syncbuf</code> &#30340;&#23454;&#20363;&#65292;&#23558;&#20854;&#21516;&#27493;&#26102;&#21457;&#29983;&#65288; emit-on-sync &#65289;&#31574;&#30053;&#35774;&#20026; <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw2">false</span></span></span> &#65292;&#34987;&#21253;&#35013;&#27969;&#32531;&#20914;&#35774;&#20026; <code>obuf</code> &#65292;&#24182;&#20197; <code>a</code> &#20026;&#20020;&#26102;&#23384;&#20648;&#30340;&#20998;&#37197;&#22120;&#12290;</div>
<div class="t-li1"><span class="t-li">3)</span> &#31227;&#21160;&#26500;&#36896;&#20989;&#25968;&#65306;&#36890;&#36807;&#20174;&#21478;&#19968; <code>std::basic_syncbuf</code> &#23545;&#35937; <code>rhs</code> &#31227;&#21160;&#25152;&#26377;&#20869;&#23481;&#65292;&#21253;&#25324;&#20020;&#26102;&#23384;&#20648;&#12289;&#34987;&#21253;&#35013;&#27969;&#25351;&#38024;&#12289;&#31574;&#30053;&#21450;&#25152;&#26377;&#20854;&#20182;&#29366;&#24577;&#65288;&#20363;&#22914;&#20114;&#26021;&#25351;&#38024;&#65289;&#65292;&#31227;&#21160;&#26500;&#36896; <code>std::basic_syncbuf</code> &#23545;&#35937;&#12290;&#31227;&#21160;&#21518;&#65292; <code>rhs</code> &#19981;&#19982;&#27969;&#20851;&#32852;&#65292;&#32780; <span class="t-c"><span class="mw-geshi cpp source-cpp">rhs.<span class="me1">get_wrapped</span><span class="br0">(</span><span class="br0">)</span><span class="sy1">==</span>nullptr</span></span> &#12290; <code>rhs</code> &#30340;&#22522;&#31867; <span class="t-lc"><a href="cpp-io-basic_streambuf.html">std::basic_streambuf</a></span> &#30340;&#25918;&#32622;&#21306;&#25351;&#38024;&#20445;&#35777;&#20026;&#31354;&#12290;&#38144;&#27585;&#34987;&#31227;&#21160;&#30340; <code>rhs</code> &#23558;&#19981;&#20135;&#29983;&#20219;&#20309;&#36755;&#20986;&#12290;</div>
<h3><span class="mw-headline" id=".E5.8F.82.E6.95.B0">&#21442;&#25968;</span></h3>
<table class="t-par-begin">
<tr class="t-par">
<td>obuf</td>
<td>-</td>
<td>&#25351;&#21521;&#35201;&#21253;&#35013;&#30340; <span class="t-lc"><a href="cpp-io-basic_streambuf.html">std::basic_streambuf</a></span> &#30340;&#25351;&#38024;</td>
</tr>
<tr class="t-par">
<td>a</td>
<td>-</td>
<td>&#29992;&#20110;&#20020;&#26102;&#23384;&#20648;&#30340;&#20998;&#37197;&#22120;</td>
</tr>
<tr class="t-par">
<td>rhs</td>
<td>-</td>
<td>&#20316;&#20026;&#31227;&#21160;&#26469;&#28304;&#30340;&#21478;&#19968; std::basic_syncbuf</td>
</tr>
</table>
<h3><span class="mw-headline" id=".E5.BC.82.E5.B8.B8">&#24322;&#24120;</span></h3>
<div class="t-li1"><span class="t-li">2,3)</span> &#21487;&#33021;&#20174;&#20869;&#37096;&#20020;&#26102;&#23384;&#20648;&#30340;&#26500;&#36896;&#20989;&#25968;&#25243;&#20986; <span class="t-lc"><a href="cpp-memory-new-bad_alloc.html">std::bad_alloc</a></span> &#65292;&#25110;&#20174;&#20114;&#26021;&#30340;&#26500;&#36896;&#25243;&#20986; <span class="t-lc"><a href="cpp-error-system_error.html">std::system_error</a></span> &#12290;</div>
<h3><span class="mw-headline" id=".E6.B3.A8.E8.A7.A3">&#27880;&#35299;</span></h3>
<p>&#36890;&#24120;&#20026; <span class="t-lc">std::basic_osyncstream</span> &#30340;&#36866;&#24403;&#26500;&#36896;&#20989;&#25968;&#25152;&#35843;&#29992;&#12290;</p>
<h3><span class="mw-headline" id=".E7.A4.BA.E4.BE.8B">&#31034;&#20363;</span></h3>
<table class="metadata plainlinks ambox mbox-small-left ambox-notice" style="">
<tr>
<td class="mbox-empty-cell"></td>
<td class="mbox-text" style="">&#26412;&#33410;&#26410;&#23436;&#25104;<br />
&#21407;&#22240;&#65306;&#26242;&#26080;&#31034;&#20363;</td>
</tr>
</table>
<h3><span class="mw-headline" id=".E5.8F.82.E9.98.85">&#21442;&#38405;</span></h3>
<table class="t-dsc-begin">
<tr class="t-dsc">
<td>
<div class="t-dsc-member-div">
<div><a href="cpp-io-basic_streambuf-pubsync.html"><span class="t-lines"><span>sync</span></span></a></div>
<div><span class="t-lines"><span><span class="t-cmark">[&#34394;]</span></span></span></div>
</div>
</td>
<td>&#23558;&#32531;&#20914;&#19982;&#20851;&#32852;&#30340;&#23383;&#31526;&#24207;&#21015;&#21516;&#27493;<br />
<span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> &#30340;&#34394;&#21463;&#20445;&#25252;&#25104;&#21592;&#20989;&#25968;)</span></td>
</tr>
<tr class="t-dsc">
<td>
<div class="t-dsc-member-div">
<div><a href="cpp-io-basic_syncbuf-emit.html"><span class="t-lines"><span>emit</span></span></a></div>
</div>
</td>
<td>&#21407;&#23376;&#22320;&#20256;&#36755;&#25972;&#20010;&#20869;&#37096;&#32531;&#20914;&#21306;&#32473;&#34987;&#21253;&#35013; streambuf<br />
<span class="t-mark">(&#20844;&#24320;&#25104;&#21592;&#20989;&#25968;)</span></td>
</tr>
</table>
</div>
<div class="visualClear"></div>
</div>
</div>
</div>
</body>
</html>