Exception must always use temporary instead of global copied exception instances, it's not recommended and should have undefined issues
#include <iomanip>
#include <vector>
-SerializationError eof_ser_err("Attempted read past end of data");
-
////
//// BufReader
////
//// BufReader
////
-extern SerializationError eof_ser_err;
-
#define MAKE_BUFREADER_GETNOEX_FXN(T, N, S) \
inline bool get ## N ## NoEx(T *val) \
{ \
{ \
T val; \
if (!get ## N ## NoEx(&val)) \
- throw eof_ser_err; \
+ throw SerializationError("Attempted read past end of data"); \
return val; \
}
inline void getRawData(void *val, size_t len)
{
if (!getRawDataNoEx(val, len))
- throw eof_ser_err;
+ throw SerializationError("Attempted read past end of data");
}
inline size_t remaining()