1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<HTML> 3<HEAD> 4 <TITLE>Function Template optimal_buffer_size</TITLE> 5 <LINK REL="stylesheet" HREF="../../../../boost.css"> 6 <LINK REL="stylesheet" HREF="../theme/iostreams.css"> 7</HEAD> 8<BODY> 9 10<!-- Begin Banner --> 11 12 <H1 CLASS="title">Function Template <CODE>optimal_buffer_size</CODE></H1> 13 <HR CLASS="banner"> 14 15<!-- End Banner --> 16 17<DL class="page-index"> 18 <DT><A href="#overview">Overview</A></DT> 19 <DT><A href="#headers">Headers</A></DT> 20 <DT><A href="#reference">Reference</A></DT> 21</DL> 22 23<A NAME="overview"></A> 24<H2>Overview</H2> 25 26<P> 27 The function template <CODE>optimal_buffer_size</CODE> returns the size of the character buffer which is allocated for a Filter or Device by library streams, stream buffers and chains if no buffer size is explicitly specified. 28</P> 29 30<A NAME="headers"></A> 31<H2>Headers</H2> 32 33<DL> 34 <DT><A CLASS="header" HREF="../../../../boost/iostreams/optimal_buffer_size.hpp"><CODE><boost/iostreams/optimal_buffer_size.hpp></CODE></A></DT> 35 <DT><A CLASS="header" HREF="../../../../boost/iostreams/operations.hpp"><CODE><boost/iostreams/operations.hpp></CODE></A></DT> 36</DL> 37 38<A NAME="reference"></A> 39<H2>Reference</H2> 40 41<A NAME="synopsis"></A> 42<H4>Synopsis</H4> 43 44<PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams { 45 46<SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#template_params">T</A>> 47std::streamsize <A CLASS="documented" HREF="#optimal_buffer_size">optimal_buffer_size</A>(T& t); 48 49} } <SPAN CLASS="comment">// End namespace boost::io</SPAN></PRE> 50 51<A NAME="template_params"></A> 52<H4>Template Parameters</H4> 53 54<TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2> 55<TR> 56 <TR> 57 <TD VALIGN="top"><I>T</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> 58 <TD>A model of <A HREF="../concepts/filter.html">Filter</A> or <A HREF="../concepts/device.html">Device</A>. 59 </TR> 60</TABLE> 61 62<A NAME="optimal_buffer_size"></A> 63<PRE CLASS="broken_ie"><SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> T> 64std::streamsize optimal_buffer_size(T& t);</PRE> 65 66<P>The semantics of <CODE>optimal_buffer_size</CODE> depends on the <A HREF="../guide/traits.html#category">category</A> of <CODE>T</CODE> as follows:</P> 67 68<TABLE STYLE="margin-left:2em;margin-bottom:2em" BORDER=1 CELLPADDING=4> 69 <TR><TH><CODE>category_of<T>::type</CODE></TH><TH>semantics</TH></TR> 70 <TR> 71 <TD VALIGN="top">convertible to <A HREF="../guide/traits.html#category_tags"><CODE>optimally_buffered_tag</CODE></A></TD> 72 <TD>Returns <CODE>t.optimal_buffer_size()</CODE>.</TD> 73 </TR> 74 <TR> 75 <TD VALIGN="top">convertible to <A HREF="../guide/traits.html#category_tags"><CODE>filter_tag</CODE></A> but not to <A HREF="../guide/traits.html#category_tags"><CODE>optimally_buffered_tag</CODE></A></TD> 76 <TD>Returns <A HREF='../macros/buffer_sizes.html'><CODE>default_filter_buffer_size</CODE></A>.</TD> 77 </TR> 78 <TR> 79 <TD VALIGN="top">otherwise</TD> 80 <TD>Returns <A HREF='../macros/buffer_sizes.html'><CODE>default_device_buffer_size</CODE></A>.</TD> 81 </TR> 82</TABLE> 83 84<!-- Begin Footer --> 85 86<HR> 87 88<P CLASS="copyright">© Copyright 2008 <a href="http://www.coderage.com/" target="_top">CodeRage, LLC</a><br/>© Copyright 2004-2007 <a href="https://www.boost.org/users/people/jonathan_turkanis.html" target="_top">Jonathan Turkanis</a></P> 89<P CLASS="copyright"> 90 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <A HREF="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>) 91</P> 92 93<!-- End Footer --> 94 95</BODY>