Explorar o código

Resolve use of deprecated ::result_type typedef.

Also adds #include <utility> since this file names std::move.

```
         D:\buildtrees\libdatachannel\src\v0.12.0-2d418b9dcd.clean\include\rtc\utils.hpp(35,23): error C4996: 'std::_Weak_result_type<std::_Is_memfunptr<void (__cdecl rtc::impl::PeerConnection::* )(std::weak_ptr<_Ty>)>,void>::result_type': warning STL4007: Many result_type typedefs and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning. [D:\buildtrees\libdatachannel\x64-uwp-dbg\datachannel.vcxproj]
         D:\buildtrees\libdatachannel\src\v0.12.0-2d418b9dcd.clean\include\rtc\utils.hpp(35,23): error C4996: 'std::_Weak_result_type<std::_Is_memfunptr<void (__cdecl rtc::impl::PeerConnection::* )(rtc::Candidate)>,void>::result_type': warning STL4007: Many result_type typedefs and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning. [D:\buildtrees\libdatachannel\x64-uwp-dbg\datachannel.vcxproj]
         D:\buildtrees\libdatachannel\src\v0.12.0-2d418b9dcd.clean\include\rtc\utils.hpp(35,23): error C4996: 'std::_Weak_result_type<std::_Is_memfunptr<bool (__cdecl rtc::impl::PeerConnection::* )(const std::string &) const>,void>::result_type': warning STL4007: Many result_type typedefs and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning. [D:\buildtrees\libdatachannel\x64-uwp-dbg\datachannel.vcxproj]
         D:\buildtrees\libdatachannel\src\v0.12.0-2d418b9dcd.clean\include\rtc\utils.hpp(35,23): error C4996: 'std::_Weak_result_type<std::_Is_memfunptr<void (__cdecl rtc::impl::PeerConnection::* )(rtc::message_ptr)>,void>::result_type': warning STL4007: Many result_type typedefs and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning. [D:\buildtrees\libdatachannel\x64-uwp-dbg\datachannel.vcxproj]
         D:\buildtrees\libdatachannel\src\v0.12.0-2d418b9dcd.clean\include\rtc\utils.hpp(35,23): error C4996: 'std::_Weak_result_type<std::_Is_memfunptr<void (__cdecl rtc::impl::PeerConnection::* )(uint16_t,size_t)>,void>::result_type': warning STL4007: Many result_type typedefs and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning. [D:\buildtrees\libdatachannel\x64-uwp-dbg\datachannel.vcxproj]
```
Billy Robert O'Neal III %!s(int64=4) %!d(string=hai) anos
pai
achega
a15b2ad468
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      include/rtc/utils.hpp

+ 2 - 2
include/rtc/utils.hpp

@@ -24,6 +24,7 @@
 #include <mutex>
 #include <optional>
 #include <tuple>
+#include <utility>
 
 namespace rtc {
 
@@ -34,11 +35,10 @@ template <class... Ts> overloaded(Ts...) -> overloaded<Ts...>;
 // weak_ptr bind helper
 template <typename F, typename T, typename... Args> auto weak_bind(F &&f, T *t, Args &&..._args) {
 	return [bound = std::bind(f, t, _args...), weak_this = t->weak_from_this()](auto &&...args) {
-		using result_type = typename decltype(bound)::result_type;
 		if (auto shared_this = weak_this.lock())
 			return bound(args...);
 		else
-			return static_cast<result_type>(false);
+			return static_cast<decltype(bound(args...))>(false);
 	};
 }