# Function Template `putback`

Overview
Headers
Reference

## Overview

The function template `put` provides a uniform interface for putting back characters read from models of Peekable, for use in the definitions of Filters.

## Headers

`<boost/iostreams/operations.hpp>`
`<boost/iostreams/putback.hpp>`

## Reference

#### Description

Attempt to putback a character to a given instance of the template parameter `Peekable`, returning `true` for success.

#### Synopsis

    namespace boost { namespace iostreams {

        template<typename Peekable>
        bool putback(Peekable& peekable, typename char_type_of<Peekable>::type c);

    } } // End namespace boost::io

#### Template Parameters

Peekable | - | A model of Peekable.

#### Semantics

The semantics of `putback` depends on the category of `Peekable` as follows:

`category_of<Peekable>::type` | semantics
--- | ---
convertible to `istream_tag` | invokes `peekable.rdbuf()->putback(c)` and returns `true` if the operation was successful
convertible to `streambuf_tag` but not to `istream_tag` | invokes `peekable.sputbackc(c)` and returns `true` if the operation was successful
convertible to `peekable_tag` but not to `streambuf_tag` or `istream_tag` | returns `peekable.putback(c)`
otherwise | compile-time error

Revised 20 May, 2004

© Copyright Jonathan Turkanis, 2004

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)