Boost logo

Boost Users :

Subject: Re: [Boost-users] [Iostreams] Safely returning filtering_istream from function
From: Larry Evans (cppljevans_at_[hidden])
Date: 2013-06-06 07:37:09


On 06/05/13 07:37, Szymon Gatner wrote:
> Hi,
>
> I would like to return filtering_istream via
> std::unique_ptr<std::iostream> so that client code can just use iostream
> interface without knowing what is actual stream type.
>
> Inside the factory function filtering_istream is prepared with possible
> filters attached. Problem is filters are attached by reference.

Do you mean that the filter is passed to the filtering_istream CTOR
with a ref_wrapper, as described in item 1 of:

  A filtering_stream may be constructed from an instance of a Filter
  or Device type T which is not CopyConstructible in one of two ways:

     * by using a reference wrapper, or
     * if T is a standard stream or stream buffer type, by using the
       constructor taking a non-const reference.

from:

http://www.boost.org/doc/libs/1_53_0/libs/iostreams/doc/classes/filtering_stream.html

?

[snip]

-regards,
Larry


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net