# Class Template `char_traits`

Description
Headers
Reference

## Description

The class template `boost::iostreams::char_traits` is a derived class of `std::char_traits` which has an additional static function `would_block`, used to indicate that an attempt to read a character has failed because no input is currently available.

The constants `WOULD_BLOCK` and `WWOULD_BLOCK` are provided for convenience.

## Headers

`<boost/iostreams/char_traits.hpp>`

## Reference

### Synopsis

    namespace boost { namespace iostreams {

    const int WOULD_BLOCK;

    const std::wint_t WWOULD_BLOCK;

    template<typename Ch>
    class char_traits : public std::char_traits<Ch> {
        static typename std::char_traits<Ch>::int_type would_block();
    };

    } } // End namespace boost::io

### Constant `WOULD_BLOCK`

        const int WOULD_BLOCK;

The return value of `char_traits<char>::would_block`. Used by the function template `get` to indicate that no character could be returned because input was temporarily unavailable.

### Constant `WWOULD_BLOCK`

        const std::wint_t WWOULD_BLOCK;

The return value of `char_traits<wchar_t>::would_block`. Used by the function template `get` to indicate that no character could be returned because input was temporarily unavailable.

### Class Template `boost::iostreams::char_traits`

#### Template parameters

Ch | - | The character type

#### `char_traits::would_block`

        static typename std::char_traits<Ch>::int_type would_block();

Returns an instance of `int_type` used by the function template `get` to indicate that an attempt to read a character from a Source has failed because no input is currently available. Future attempts to read a character may succeed.

© 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)