Inheriting from basic_iostream and streambuf
Hello!
I am writing a library for an embedded system where I want to provide the user with an std::basic_iostream interface to some peripheral (let's say an UART).
The straightforward way to do this is to derive from std::streambuf, and wrap it with a std::basic_iostream.
The problem is I also want to provide an asynchronous IO interface, which basic_iostream doesn't support, and the user can no longer (easily) get to my class with the basic_iostream wrapper.
How would you design this?
I can have my class inherit from both iostream and streambuf, and pass "this" as the streambuf to iostream ctor, but that feels dirty...
Thanks