mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-23 15:48:03 +00:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
e4ab5273fc | |||
bf0b3ce1b9 |
@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.7)
|
cmake_minimum_required(VERSION 3.7)
|
||||||
project(libdatachannel
|
project(libdatachannel
|
||||||
VERSION 0.12.2
|
VERSION 0.12.3
|
||||||
LANGUAGES CXX)
|
LANGUAGES CXX)
|
||||||
set(PROJECT_DESCRIPTION "WebRTC Data Channels Library")
|
set(PROJECT_DESCRIPTION "WebRTC Data Channels Library")
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace rtc {
|
namespace rtc {
|
||||||
|
|
||||||
@ -32,11 +33,10 @@ template <class... Ts> overloaded(Ts...) -> overloaded<Ts...>;
|
|||||||
// weak_ptr bind helper
|
// weak_ptr bind helper
|
||||||
template <typename F, typename T, typename... Args> auto weak_bind(F &&f, T *t, Args &&..._args) {
|
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) {
|
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())
|
if (auto shared_this = weak_this.lock())
|
||||||
return bound(args...);
|
return bound(args...);
|
||||||
else
|
else
|
||||||
return static_cast<result_type>(false);
|
return static_cast<decltype(bound(args...))>(false);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user