-
-
Save rightfold/ed3681d9494a75e585de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Stream { | |
public: | |
Stream(std::vector<unsigned char> const& data) | |
: data(&data) { } | |
void seek(std::size_t newOffset) { | |
if (newOffset >= data->size()) { | |
throw "fuck"; | |
} | |
offset = newOffset; | |
} | |
unsigned char read() { | |
seek(offset + 1); | |
return data->at(offset); | |
} | |
private: | |
std::size_t offset; | |
std::vector<unsigned char> const* data; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment