iostreams: streambuf class fails to compile on type check

I'm trying to insert my own stream buffer into a boost stream. Here is the code <http://hostcode.sourceforge.net/view/5044> At the top are two arbitrary streambuf derived classes I copied from the web that are said to work with the std::stream. They don't work either. My work is in the rtf namespace. In main there is a test with my device, file_source, and std::ifstream derived, they all work. Then I've tried the likes of: rtf::basic_stream< char, char_array_buffer > io_4( input ); rtf::basic_stream< char, outbuf > io_4( input ); and the one I want to work: rtf::basic_stream< char, rtf::rtf_stream_buffer > io_4( input ); they all fail at: { BOOST_STATIC_ASSERT(is_std_io<T>::value); } line 66 in concept_adapter.hpp. All the classes are derived from std::basic_streambuf which is on the list #ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES And I could not find it defined with agent ransack So, I seem to be missing something fundamental and just don't know what it could be. Thanks. Dan.

AMDG On 03/12/2016 07:48 PM, Dan Bloomquist wrote:
I'm trying to insert my own stream buffer into a boost stream. Here is the code <http://hostcode.sourceforge.net/view/5044>
At the top are two arbitrary streambuf derived classes I copied from the web that are said to work with the std::stream. They don't work either.
My work is in the rtf namespace. In main there is a test with my device, file_source, and std::ifstream derived, they all work. Then I've tried the likes of:
rtf::basic_stream< char, char_array_buffer > io_4( input ); rtf::basic_stream< char, outbuf > io_4( input ); and the one I want to work: rtf::basic_stream< char, rtf::rtf_stream_buffer > io_4( input );
they all fail at: { BOOST_STATIC_ASSERT(is_std_io<T>::value); } line 66 in concept_adapter.hpp. All the classes are derived from std::basic_streambuf which is on the list #ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES
And I could not find it defined with agent ransack So, I seem to be missing something fundamental and just don't know what it could be.
It fails because char_array_buffer doesn't meet the requirements of boost::iostreams::stream. T - A CopyConstructible model of one of the Device concepts http://www.boost.org/doc/libs/1_60_0/libs/iostreams/doc/guide/generic_stream... In particular, it is not CopyConstructible. In Christ, Steven Watanabe

AMDG
It fails because char_array_buffer doesn't meet the requirements of boost::iostreams::stream.
T - A CopyConstructible model of one of the Device concepts
http://www.boost.org/doc/libs/1_60_0/libs/iostreams/doc/guide/generic_stream...
In particular, it is not CopyConstructible. Hi Steven, Thanks. I tried a deceleration of every kind of constructor. It may be
Steven Watanabe wrote: that I hit that because somewhere I could not resolve where my class gets cast to constant when trying to use my own streambuf rather than a device: c:\cpp\boost_1_60\modular-boost\boost\iostreams\detail\adapter\concept_adapter.hpp(68): error C2440: 'initializing': cannot convert from 'const rtf::rtf_stream_buffer<rtf::my_dev<Char>>' to 'rtf::rtf_stream_buffer<rtf::my_dev<Char>> ' When my_dev is derived from a streambuf, boost or standard. is the likes of: boost::iostreams::stream< my_or_std_streambuf >... is just not doable? It almost works. I could not find a single example of using a specialized stream_buffer with boost stream. I'll come back to this someday. For now I'm running out of brain cells and I need to deal with my task at hand. Best, Dan.
participants (2)
-
Dan Bloomquist
-
Steven Watanabe