The following sample does not compile, complaining that
In file included from /usr/include/msgpack.hpp:18:
/usr/include/msgpack/object.hpp:211:3: error: member reference base type 'logd::log_level' is not a structure or union
and a corresponding error for the other enum class. My question is how, using msgpack's c++ api, does one serialize a class with members that are of c++11 enum class
type?
#ifndef LOG_MSG_HPP_
#define LOG_MSG_HPP_
#include <stdlib.h>
#include <msgpack.hpp>
/** @namespace logd */
namespace logd {
enum class log_level { SILENT,... DEBUG };
enum class log_domain { AI, ... MISC };
class log_msg {
public:
log_msg(log_level lev, log_domain dom, std::string msg);
log_level level();
log_domain domain();
std::string message();
~log_msg();
MSGPACK_DEFINE(lev_, dom_, msg_);
private:
log_msg();
log_level lev_ {log_level::DEBUG};
log_domain dom_ {log_domain::MISC};
std::string msg_ {"No message given."};
};
} /* namespace logd */
#endif /* LOG_MSG_HPP_ */
NOTE: Since the enums are mine, I can happily modify them to make msgpack happy. Unfortunately, I can find no references on the subject in their docs or the first couple pages of Google. I am also not able to determine what to do from reading their headers/source since I'm rather new to c++.