Browse Source

Add reinterpret_pointer_cast implementation to fix build error

Apple clang does not implement reinterpret_pointer_cast as mentioned here: https://github.com/conda-forge/libcxx-feedstock/issues/44
Filip Klembara 4 years ago
parent
commit
ffa4e4bb20
1 changed files with 11 additions and 0 deletions
  1. 11 0
      src/peerconnection.cpp

+ 11 - 0
src/peerconnection.cpp

@@ -33,6 +33,17 @@
 #include <iomanip>
 #include <thread>
 
+#if __clang__
+namespace std {
+
+template <typename To, typename From>
+inline std::shared_ptr<To> reinterpret_pointer_cast(std::shared_ptr<From> const & ptr) noexcept {
+    return std::shared_ptr<To>(ptr, reinterpret_cast<To *>(ptr.get()));
+}
+
+}
+#endif
+
 namespace rtc {
 
 using namespace std::placeholders;