add custom class example

This commit is contained in:
qicosmos
2019-01-09 15:08:25 +08:00
parent f114d1bdf5
commit 01b5686f7f
2 changed files with 36 additions and 0 deletions
+23
View File
@@ -47,7 +47,30 @@ void test_hello() {
}
}
struct person {
int id;
std::string name;
int age;
MSGPACK_DEFINE(id, name, age);
};
void test_get_person_name() {
try {
boost::asio::io_service io_service;
test_client client(io_service);
client.connect("127.0.0.1", "9000");
auto result = client.call<std::string>("get_person_name", person{1, "tom", 20});
std::cout << result << std::endl;
}
catch (const std::exception& e) {
std::cout << e.what() << std::endl;
}
}
int main() {
test_get_person_name();
test_hello();
test_add();
test_translate();