Closure.h: use static_assert instead of LOG(FATAL)

GitOrigin-RevId: a17ebc84d49ce763ffa64c8db0f85638bb5ace63
This commit is contained in:
Arseny Smirnov 2020-09-09 19:42:37 +03:00
parent fdc3920572
commit 958b16b8a3

View File

@ -124,16 +124,15 @@ class DelayedClosure {
explicit DelayedClosure( explicit DelayedClosure(
const DelayedClosure<FromActorT, FromFunctionT, FromArgsT...> &other, const DelayedClosure<FromActorT, FromFunctionT, FromArgsT...> &other,
std::enable_if_t<!LogicAnd<std::is_copy_constructible<FromArgsT>::value...>::value, int> = 0) { std::enable_if_t<!LogicAnd<std::is_copy_constructible<FromArgsT>::value...>::value, int> = 0) {
LOG(FATAL) << "Deleted constructor"; static_assert(std::is_same<FromActorT, FromActorT>::value, "Deleted constructor");
std::abort();
} }
template <class FromActorT, class FromFunctionT, class... FromArgsT> template <class FromActorT, class FromFunctionT, class... FromArgsT>
std::enable_if_t<!LogicAnd<std::is_copy_constructible<FromArgsT>::value...>::value, std::enable_if_t<!LogicAnd<std::is_copy_constructible<FromArgsT>::value...>::value,
DelayedClosure<FromActorT, FromFunctionT, FromArgsT...>> DelayedClosure<FromActorT, FromFunctionT, FromArgsT...>>
do_clone(const DelayedClosure<FromActorT, FromFunctionT, FromArgsT...> &value) const { do_clone(const DelayedClosure<FromActorT, FromFunctionT, FromArgsT...> &value) const {
LOG(FATAL) << "Trying to clone DelayedClosure that contains noncopyable elements"; static_assert(std::is_same<FromActorT, FromActorT>::value,
std::abort(); "Trying to clone DelayedClosure that contains noncopyable elements");
} }
template <class FromActorT, class FromFunctionT, class... FromArgsT> template <class FromActorT, class FromFunctionT, class... FromArgsT>