mirror of
https://github.com/qicosmos/rest_rpc.git
synced 2026-08-29 08:34:47 +08:00
fix compile
This commit is contained in:
@@ -218,13 +218,13 @@ void test_echo() {
|
||||
|
||||
{
|
||||
// safe call, same with `client.call<std::string>("echo", "test")`
|
||||
auto result = client.call<echo>("test");
|
||||
auto result = client.call_s<echo>("test");
|
||||
std::cout << result << std::endl;
|
||||
}
|
||||
|
||||
{
|
||||
// safe call member function
|
||||
auto result = client.call<&dummy::add>(1, 2);
|
||||
auto result = client.call_s<&dummy::add>(1, 2);
|
||||
std::cout << result << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
|
||||
for (size_t i = 0; i < pool_size; i++) {
|
||||
auto io_ctx = std::make_shared<asio::io_context>();
|
||||
works_.push_back(asio::io_context::work(*io_ctx));
|
||||
works_.push_back(asio::make_work_guard(*io_ctx));
|
||||
io_contexts_.emplace_back(io_ctx);
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,8 @@ public:
|
||||
|
||||
private:
|
||||
std::vector<std::shared_ptr<asio::io_context>> io_contexts_;
|
||||
std::vector<asio::io_context::work> works_;
|
||||
std::vector<asio::executor_work_guard<asio::io_context::executor_type>>
|
||||
works_;
|
||||
std::once_flag run_flag_;
|
||||
std::once_flag stop_flag_;
|
||||
std::atomic<size_t> next_ = 0;
|
||||
|
||||
@@ -254,7 +254,7 @@ public:
|
||||
return call<DEFAULT_TIMEOUT, T>(rpc_name, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <auto func, typename... Args> auto call(Args &&...args) {
|
||||
template <auto func, typename... Args> auto call_s(Args &&...args) {
|
||||
using args_tuple = typename function_traits<decltype(func)>::tuple_type;
|
||||
static_assert(std::is_constructible_v<remove_first_t<args_tuple>, Args...>,
|
||||
"called rpc function and arguments are not match");
|
||||
|
||||
Reference in New Issue
Block a user