[ox/event] Move isError into namepsace detail

This commit is contained in:
Gary Talent 2021-08-03 00:21:05 -05:00
parent 8f6897225a
commit 38596ac941

View File

@ -19,6 +19,8 @@ class SignalHandler;
#ifndef OX_OS_BareMetal #ifndef OX_OS_BareMetal
namespace detail {
template<typename T> template<typename T>
struct isError { struct isError {
static constexpr bool value = false; static constexpr bool value = false;
@ -29,6 +31,8 @@ struct isError<Error> {
static constexpr bool value = true; static constexpr bool value = true;
}; };
}
template<class... Args> template<class... Args>
class Signal { class Signal {
private: private:
@ -52,7 +56,7 @@ class Signal {
} }
void call(Args... args) final { void call(Args... args) final {
if constexpr(isError<decltype(f(args...))>::value) { if constexpr(detail::isError<decltype(f(args...))>::value) {
oxThrowError(f(args...)); oxThrowError(f(args...));
} else { } else {
f(args...); f(args...);
@ -71,7 +75,7 @@ class Signal {
} }
void call(Args... args) final { void call(Args... args) final {
if constexpr(isError<decltype((m_receiver->*(m_methodPtr))(args...))>::value) { if constexpr(detail::isError<decltype((m_receiver->*(m_methodPtr))(args...))>::value) {
oxThrowError((m_receiver->*(m_methodPtr))(args...)); oxThrowError((m_receiver->*(m_methodPtr))(args...));
} else { } else {
f(args...); f(args...);
@ -98,7 +102,7 @@ class Signal {
} }
void call(Args... args) final { void call(Args... args) final {
if constexpr(isError<decltype((m_receiver->*(m_methodPtr))(args...))>::value) { if constexpr(detail::isError<decltype((m_receiver->*(m_methodPtr))(args...))>::value) {
oxThrowError((m_receiver->*(m_methodPtr))(args...)); oxThrowError((m_receiver->*(m_methodPtr))(args...));
} else { } else {
(m_receiver->*(m_methodPtr))(args...); (m_receiver->*(m_methodPtr))(args...);