[iostreams] patch for close(sink, in|out)

Hello, I noticed that there is a problem in treating the parameter "which" on iostreams::close(). So, the following code doesn't output anything to standard output. #include <boost/iostreams/categories.hpp> #include <boost/iostreams/close.hpp> #include <iostream> namespace io = boost::iostreams; class test_sink { public: typedef char char_type; struct category : io::output, io::device_tag, io::closable_tag {}; std::streamsize write(const char*, std::streamsize n) { return n; } void close() { std::cout << "called test_sink::close()" << std::endl; } }; int main() { test_sink sink; // doesn't call test_sink::close() io::close(sink, BOOST_IOS::in|BOOST_IOS::out); } OTH, some device adapters in Boost.Iostreams perform such function call for closing the external device. Such the adapters never close the external device. The attachment is a patch for this problem. Regards, Takeshi Mouri
participants (1)
-
Takeshi Mouri