Back to Arangodb

Function Template put

3rdParty/boost/1.78.0/libs/iostreams/doc/functions/put.html

3.12.9.12.7 KB
Original Source

Function Template put

OverviewExampleHeadersReference

Overview

The function template put provides a uniform interface for writing a character to a Sink, for use in the definitions of new Filter types (see Example).

Example

The following code illustrates the use of the function put in the definition of an OutputFilter.

#include\<ctype.h\>// toupper#include[\<boost/iostreams/concepts.hpp\>](../../../../boost/iostreams/concepts.hpp)// output\_filter#include[\<boost/iostreams/operations.hpp\>](../../../../boost/iostreams/operations.hpp)// putusingnamespacestd;namespaceio = boost::iostreams;structtoupper_filter :publicio::output_filter {template<typenameSink>boolput(Sink& snk,charc)
        {returnio::put(snk, toupper((unsignedchar) c));
        }
    };

Headers

<boost/iostreams/operations.hpp><boost/iostreams/put.hpp>

Reference

Description

Attempts to write a character to a given instance of the template parameter Sink, returning true for success.

Synopsis

namespaceboost {namespaceiostreams {template<typename[Sink](#template_params)>voidput(Sink&[snk](#function_params),typename[char\_type\_of](../guide/traits.html#char_type_of_ref)<Sink>::type c);

} }// End namespace boost::io

Template Parameters

| | | | Sink | - | A indirect model of Sink or a standard output stream or stream buffer type. |

Function Parameters

| | | | snk | - | An instance of Sink |

Semantics

template<typenameSink>voidput(Sink& snk,typenamechar_type_of<Sink>::type c);

The semantics of put depends on the category of Sink as follows:

category_of<Sink>::typesemantics
convertible to direct_tagcompile-time error
convertible to ostream_taginvokes snk.put(c)
convertible to streambuf_tag but not to ostream_taginvokes snk.sputc(c)
otherwiseinvokes snk.write(&c, 1)

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