error: no member named 'serialize'
gerald-dotcom opened this issue · comments
We are trying to serialize a class with your great library but clang++ compiler outputs following error messages,
In file included from ./hps/src/hps.h:6:
In file included from ./hps/src/basic_type/basic_type.h:4:
In file included from ./hps/src/basic_type/float_serializer.h:6:
./hps/src/serializer.h:14:49: error: no member named 'serialize' in 'std::variant<std::vector<std::byte, std::allocator<std::byte> >, std::__cxx11::basic_string<char> >'
static void serialize(const T& t, B& buf) { t.serialize(buf); }
~ ^
./hps/src/buffer/string_output_buffer.h:46:40: note: in instantiation of member function 'hps::Serializer<std::variant<std::vector<std::byte, std::allocator<std::byte> >, std::__cxx11::basic_string<char> >, hps::StringOutputBuffer, void>::serialize' requested here
Serializer<T, StringOutputBuffer>::serialize(t, *this);
^
Here is the class,
class message
{
public:
std::string id;
int status;
std::variant<std::vector<std::byte>, std::string> body;
template <class B>
void serialize(B &buf) const
{
buf << id << status << body;
}
template <class B>
void parse(B &buf)
{
buf >> id >> status >> body;
}
};