Skip to content

Commit

Permalink
rpc: rpc_types: replace boost::any with std::any
Browse files Browse the repository at this point in the history
Technically speaking the type was public, but realistically everyone
should have used the provided accessors.
  • Loading branch information
avikivity committed Sep 30, 2024
1 parent a3d7893 commit 867a242
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions include/seastar/rpc/rpc_types.hh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <seastar/net/api.hh>
#include <stdexcept>
#include <string>
#include <boost/any.hpp>
#include <any>
#include <boost/type.hpp>
#include <seastar/util/std-compat.hh>
#include <seastar/util/variant_utils.hh>
Expand Down Expand Up @@ -99,16 +99,16 @@ struct client_info {
socket_address addr;
rpc::server& server;
connection_id conn_id;
std::unordered_map<sstring, boost::any> user_data;
std::unordered_map<sstring, std::any> user_data;
template <typename T>
void attach_auxiliary(const sstring& key, T&& object) {
user_data.emplace(key, boost::any(std::forward<T>(object)));
user_data.emplace(key, std::any(std::forward<T>(object)));
}
template <typename T>
T& retrieve_auxiliary(const sstring& key) {
auto it = user_data.find(key);
assert(it != user_data.end());
return boost::any_cast<T&>(it->second);
return std::any_cast<T&>(it->second);
}
template <typename T>
std::add_const_t<T>& retrieve_auxiliary(const sstring& key) const {
Expand All @@ -120,15 +120,15 @@ struct client_info {
if (it == user_data.end()) {
return nullptr;
}
return &boost::any_cast<T&>(it->second);
return &std::any_cast<T&>(it->second);
}
template <typename T>
const T* retrieve_auxiliary_opt(const sstring& key) const noexcept {
auto it = user_data.find(key);
if (it == user_data.end()) {
return nullptr;
}
return &boost::any_cast<const T&>(it->second);
return &std::any_cast<const T&>(it->second);
}
};

Expand Down

0 comments on commit 867a242

Please sign in to comment.