Skip to content

Instantly share code, notes, and snippets.

@rightfold

rightfold/.cpp Secret

Created September 7, 2015 15:56
Show Gist options
  • Save rightfold/7f8d575de564bad77ee3 to your computer and use it in GitHub Desktop.
Save rightfold/7f8d575de564bad77ee3 to your computer and use it in GitHub Desktop.
template<typename Reader>
void read_full(Reader&& reader, char* begin, char* end) {
while (begin != end) {
auto new_begin = reader.read(begin, end);
if (new_begin == begin) {
throw unexpected_eof(__func__);
}
begin = new_begin;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment