accept more TLS versions, ignore zero return
[ghsmtp.git] / imemstream.hpp
blob941df806949c9deee41824b595b0827a9e8c8c39
1 #ifndef IMEMSTREAM_DOT_HPP
2 #define IMEMSTREAM_DOT_HPP
4 #include <istream>
5 #include <streambuf>
6 #include <string_view>
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)
18 : membuf(base, 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