I want to use a class with stream-members.
My code looks like that:
//! pushes a Source and InputFilters into a filtering_istream
class FilterChain {
public:
//! create an empty FilterChain
FilterChain(){
init();
}
private:
//! the stream to connect Source and InputFilters together
io::filtering_istream* m_filteringStream;
//! stream to use by other classes
std::istream* m_stream;
void init(){
std::streambuf* streamBuffer = m_filteringStream->rdbuf();
m_stream->rdbuf(streamBuffer);
}
};
I get an error message that the std::basic_istream constructor is protected:
/usr/include/c++/4.8.1/istream: In member function `void FilterChain::init()': /usr/include/c++/4.8.1/istream:606:7: Error: `std::basic_istream<_CharT, _Traits>::basic_istream() [with _CharT = char; _Traits = std::char_traits]' is protected
I tried stream references as well but that caused the same error. Any ideas how to fix this?
EDIT 1:
Thx to sehe I fixed it with a new init() like that:
void init(){
std::streambuf* streamBuffer = m_filteringStream->rdbuf();
m_stream = new std::istream(streamBuffer);
}