1 #ifndef IMEMSTREAM_DOT_HPP
2 #define IMEMSTREAM_DOT_HPP
8 struct membuf
: std::streambuf
{
9 membuf(char const* base
, size_t size
)
11 auto p
= const_cast<char*>(base
);
12 this->setg(p
, p
, p
+ size
);
16 struct imemstream
: virtual membuf
, std::istream
{
17 imemstream(char const* base
, size_t size
)
19 , std::istream(static_cast<std::streambuf
*>(this))
22 imemstream(std::string_view s
)
23 : membuf(s
.data(), s
.length())
24 , std::istream(static_cast<std::streambuf
*>(this))
29 #endif // IMEMSTREAM_DOT_HPP