fix msvc warning

This commit is contained in:
arvidn 2020-02-25 15:57:35 +01:00 committed by Arvid Norberg
parent 1dcbeb2e60
commit a647fd475e
2 changed files with 13 additions and 0 deletions

View File

@ -821,6 +821,11 @@ namespace libtorrent {
#if TORRENT_ABI_VERSION == 1
#ifdef _MSC_VER
#pragma warning(push, 1)
// warning C4996: X: was declared deprecated
#pragma warning( disable : 4996 )
#endif
#if defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
@ -834,6 +839,9 @@ namespace libtorrent {
#if defined __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
// ``set_i2p_proxy`` sets the i2p_ proxy, and tries to open a persistent

View File

@ -157,7 +157,12 @@ namespace std {
{
using base = std::hash<UnderlyingType>;
using argument_type = libtorrent::aux::strong_typedef<UnderlyingType, Tag>;
#if __cplusplus < 201402
// this was deprecated in C++17
using result_type = typename base::result_type;
#else
using result_type = std::size_t;
#endif
result_type operator()(argument_type const& s) const
{ return this->base::operator()(static_cast<UnderlyingType>(s)); }
};