Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
llvm-project
The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
I am writing a custom binary stream buffer inheriting from the standard std::streambuf interface. This stream buffer needs to support writing and reading to an external block of memory (not owned by the stream). So far, I could get away with only overriding the underflow and overflow member functions, which call setp, pbump, and setg with the right positions, handle the logic to circumvent the limitation of Microsoft's STL only accepting int values for offsets (which causes problems with large objects), and get/set a byte using pptr and gptr.
Doing some research on other people's experience in implementing custom stream buffers, I rarely see seekoff (and it's companion seekpos) being overriden. Boost ASIO's basic_streambuf does not. This article on writing custom stream buffers and this other article (both show up on the first page in a Google search) do not.
I did see the various STL implementations of basic_stringbuf use it, though (MSVC, libstdc++, libc++).