Skip to content

Instantly share code, notes, and snippets.

@r-lyeh-archived
Created November 2, 2015 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r-lyeh-archived/4fc7ee5a0e06e9648284 to your computer and use it in GitHub Desktop.
Save r-lyeh-archived/4fc7ee5a0e06e9648284 to your computer and use it in GitHub Desktop.
memory stream
struct membuf: std::streambuf {
membuf(char* base, std::ptrdiff_t n) {
this->setg(base, base, base + n);
}
};
membuf sbuf(base, n);
std::istream in(&sbuf);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment