diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-07-03 12:20:58 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-07-03 12:20:58 +0200 |
commit | 6426cc8f54b687484e8f0448f0a777137ede0462 (patch) | |
tree | f9a727ce5cfbb978d9bf08c98536d542ae107479 /contrib/epee/include/net/net_utils_base.h | |
parent | Merge pull request #2111 (diff) | |
parent | Remove typeid use in network_address (diff) | |
download | monero-6426cc8f54b687484e8f0448f0a777137ede0462.tar.xz |
Merge pull request #2128
8f96cfc2 Remove typeid use in network_address (moneromooo-monero)
Diffstat (limited to 'contrib/epee/include/net/net_utils_base.h')
-rw-r--r-- | contrib/epee/include/net/net_utils_base.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/contrib/epee/include/net/net_utils_base.h b/contrib/epee/include/net/net_utils_base.h index 1884412dc..3bea11985 100644 --- a/contrib/epee/include/net/net_utils_base.h +++ b/contrib/epee/include/net/net_utils_base.h @@ -115,10 +115,9 @@ namespace net_utils std::string host_str() const { return (*this) ? (*this)->host_str() : "<none>"; } bool is_loopback() const { return (*this)->is_loopback(); } bool is_local() const { return (*this)->is_local(); } - const std::type_info &type() const { return typeid(**this); } uint8_t get_type_id() const { return (*this)->get_type_id(); } - template<typename Type> Type &as() { if (type() != typeid(Type)) throw std::runtime_error("Bad type"); return *(Type*)get(); } - template<typename Type> const Type &as() const { if (type() != typeid(Type)) throw std::runtime_error("Bad type"); return *(const Type*)get(); } + template<typename Type> Type &as() { if (get_type_id() != Type::ID) throw std::runtime_error("Bad type"); return *(Type*)get(); } + template<typename Type> const Type &as() const { if (get_type_id() != Type::ID) throw std::runtime_error("Bad type"); return *(const Type*)get(); } BEGIN_KV_SERIALIZE_MAP() uint8_t type = is_store ? this_ref.get_type_id() : 0; |