Skip to content

Instantly share code, notes, and snippets.

@pmiddend
Created January 9, 2016 17:50
Show Gist options
  • Select an option

  • Save pmiddend/b4b69cb61f4481de3e45 to your computer and use it in GitHub Desktop.

Select an option

Save pmiddend/b4b69cb61f4481de3e45 to your computer and use it in GitHub Desktop.
template<typename Type,typename Error>
fcppt::either::object<Type,Error>
read_to_either(
std::istream &_stream,
fcppt::endianness::format const _format,
Error const &_error) {
return
fcppt::either::from_optional(
fcppt::io::read<Type>(_stream,_format),
[&_error]() { return _error; });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment