| Home | Libraries | People | FAQ | More

#### ostream

Return an output stream that formats values into a DynamicBuffer.

##### Synopsis

Defined in header `<boost/beast/core/ostream.hpp>`

    template<
        class DynamicBuffer>
    implementation-defined
    ostream(
        DynamicBuffer& buffer);

##### Description

This function wraps the caller provided DynamicBuffer into a `std::ostream` derived class, to allow `operator<<` stream style formatting operations.

##### Example

    ostream(buffer) << "Hello, world!" << std::endl;

##### Remarks

Calling members of the underlying buffer before the output stream is destroyed results in undefined behavior.

##### Parameters

Name | Description
--- | ---
`buffer` | An object meeting the requirements of DynamicBuffer into which the formatted output will be placed.

##### Return Value

An object derived from `std::ostream` which redirects output The wrapped dynamic buffer is not modified, a copy is made instead. Ownership of the underlying memory is not transferred, the application is still responsible for managing its lifetime. The caller is responsible for ensuring the dynamic buffer is not destroyed for the lifetime of the output stream.