Files
pycapnp/fixMaybe.h
Jason Paryani 08ad9e571f Dynamic API almost done. Reading is complete.
Still need to flesh out the writing part of the API. init functions
are making it very messy at the moment.
2013-06-28 01:04:01 -07:00

11 lines
218 B
C++

#include "kj/common.h"
#include <stdexcept>
template<typename T>
T fixMaybe(::kj::Maybe<T> val) {
KJ_IF_MAYBE(new_val, val) {
return *new_val;
} else {
throw std::invalid_argument("member was null");
}
}