fix compile

This commit is contained in:
qicosmos
2025-09-02 16:52:20 +08:00
parent 0cfc6a9315
commit 26a8e227b4
3 changed files with 6 additions and 5 deletions
+2 -2
View File
@@ -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;
}
+3 -2
View File
@@ -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;
+1 -1
View File
@@ -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");