# Function Template `optimal_buffer_size`

Overview
Headers
Reference

## Overview

The function template `optimal_buffer_size` 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.

## Headers

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

## Reference

#### Synopsis

    namespace boost { namespace iostreams {

    template<typename T>
    std::streamsize optimal_buffer_size(T& t);

    } } // End namespace boost::io

#### Template Parameters

T | - | A model of Filter or Device.

    template<typename T>
    std::streamsize optimal_buffer_size(T& t);

The semantics of `optimal_buffer_size` depends on the category of `T` as follows:

`category_of<T>::type` | semantics
--- | ---
convertible to `optimally_buffered_tag` | Returns `t.optimal_buffer_size()`.
convertible to `filter_tag` but not to `optimally_buffered_tag` | Returns `default_filter_buffer_size`.
otherwise | Returns `default_device_buffer_size`.

© Copyright 2008 CodeRage, LLC
© Copyright 2004-2007 Jonathan Turkanis

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)