3rdParty/boost/1.78.0/libs/iostreams/doc/functions/put.html
putOverviewExampleHeadersReference
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).
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));
}
};
<boost/iostreams/operations.hpp><boost/iostreams/put.hpp>
Attempts to write a character to a given instance of the template parameter Sink, returning true for success.
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
| | | | Sink | - | A indirect model of Sink or a standard output stream or stream buffer type. |
|
| |
| snk | - | An instance of Sink |
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>::type | semantics |
|---|---|
convertible to direct_tag | compile-time error |
convertible to ostream_tag | invokes snk.put(c) |
convertible to streambuf_tag but not to ostream_tag | invokes snk.sputc(c) |
| otherwise | invokes 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)