1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<HTML> 3<HEAD> 4 <TITLE>Function Template putback</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>putback</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>putback</CODE> provides a uniform interface for putting back characters read from models of <A HREF="../concepts/peekable.html">Peekable</A>, for use in the definitions of <A HREF="../concepts/filter.html">Filters</A>. 28</P> 29 30<A NAME="headers"></A> 31<H2>Headers</H2> 32 33<DL> 34 <DT><A CLASS="header" HREF="../../../../boost/iostreams/operations.hpp"><CODE><boost/iostreams/operations.hpp></CODE></A></DT> 35 <DT><A CLASS="header" HREF="../../../../boost/iostreams/putback.hpp"><CODE><boost/iostreams/putback.hpp></CODE></A></DT> 36</DL> 37 38<A NAME="reference"></A> 39<H2>Reference</H2> 40 41<A NAME="description"></A> 42<H4>Description</H4> 43 44<P>Attempt to putback a character to a given instance of the template parameter <CODE>Peekable</CODE>, returning <CODE>true</CODE> for success.</P> 45 46<A NAME="synopsis"></A> 47<H4>Synopsis</H4> 48 49<PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams { 50 51 <SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#template_params">Peekable</A>> 52 <SPAN CLASS="keyword">bool</SPAN> <A CLASS="documented" HREF="#semantics">putback</A>(Peekable& peekable, <SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="../guide/traits.html#char_type_of_ref">char_type_of</A><Peekable>::type c); 53 54} } <SPAN CLASS="comment">// End namespace boost::io</SPAN></PRE> 55 56<A NAME="template_params"></A> 57<H4>Template Parameters</H4> 58 59<TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2> 60<TR> 61 <TR> 62 <TD VALIGN="top"><I>Peekable</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> 63 <TD>A model of <A HREF="../concepts/peekable.html">Peekable</A>. 64 </TR> 65</TABLE> 66 67<A NAME="semantics"></A> 68<H4>Semantics</H4> 69 70<P>The semantics of <CODE>putback</CODE> depends on the <A HREF="../guide/traits.html#category">category</A> of <CODE>Peekable</CODE> as follows:</P> 71 72<TABLE STYLE="margin:0,0,2em,2em" BORDER=1 CELLPADDING=4> 73 <TR><TH><CODE>category_of<Peekable>::type</CODE></TH><TH>semantics</TH></TR> 74 <TR> 75 <TD VALIGN="top">convertible to <A HREF="../guide/traits.html#category_tags"><CODE>istream_tag</CODE></A></TD> 76 <TD>invokes <CODE>peekable.rdbuf()->putback(c)</CODE> and returns <CODE>true</CODE> if the operation was successful</CODE></TD> 77 </TR> 78 <TR> 79 <TD VALIGN="top">convertible to <A HREF="../guide/traits.html#category_tags"><CODE>streambuf_tag</CODE></A> but not to <A HREF="../guide/traits.html#category_tags"><CODE>istream_tag</CODE></A></TD> 80 <TD>invokes <CODE>peekable.sputbackc(c)</CODE> and returns <CODE>true</CODE> if the operation was successful</TD> 81 </TR> 82 <TR> 83 <TD VALIGN="top">convertible to <A HREF="../guide/traits.html#category_tags"><CODE>peekable_tag</CODE></A> but not to <A HREF="../guide/traits.html#category_tags"><CODE>streambuf_tag</CODE></A> or <A HREF="../guide/traits.html#category_tags"><CODE>istream_tag</CODE></A></TD> 84 <TD>returns <CODE>peekable.putback(c)</CODE></TD> 85 </TR> 86 <TR> 87 <TD VALIGN="top">otherwise</TD> 88 <TD>compile-time error</CODE></TD> 89 </TR> 90</TABLE> 91 92<!-- Begin Footer --> 93 94<HR> 95 96<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> 97<P CLASS="copyright"> 98 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>) 99</P> 100 101<!-- End Footer --> 102 103</BODY> 104