mirror of
https://github.com/zoriya/nitro.git
synced 2026-10-13 00:05:23 +00:00
* fix: Use `std::exception_ptr` to preserve message * fix: Catch exception * fix: Fix `JSIConverter` * Update AssertPromiseState.hpp * Ok kinda fix? * ugh * fix again * Update JSIConverter+Promise.hpp * chore: Rename `_result` to `_state` * feat: Allow comparing message * fix: Fix `RuntimeError.description` * feat: Test all of those error messages as well
28 lines
772 B
C++
28 lines
772 B
C++
//
|
|
// IsSharedPtrTo.hpp
|
|
// NitroModules
|
|
//
|
|
// Created by Marc Rousavy on 21.06.24.
|
|
//
|
|
|
|
#pragma once
|
|
|
|
#include <type_traits>
|
|
|
|
namespace margelo::nitro {
|
|
|
|
using namespace facebook;
|
|
|
|
// Returns whether the given type T is a shared_ptr to type P.
|
|
template <typename T, typename P>
|
|
struct is_shared_ptr_to : std::false_type {};
|
|
|
|
template <typename T, typename P>
|
|
struct is_shared_ptr_to<std::shared_ptr<T>, P> : std::is_base_of<typename std::remove_cv<typename std::remove_reference<P>::type>::type,
|
|
typename std::remove_cv<typename std::remove_reference<T>::type>::type> {};
|
|
|
|
template <typename T, typename P>
|
|
constexpr bool is_shared_ptr_to_v = is_shared_ptr_to<T, P>::value;
|
|
|
|
} // namespace margelo::nitro
|