From 04a7583bd0fb0d3796ca61716dcc6be3cb27a252 Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 17 Jul 2022 10:41:17 +0300 Subject: [PATCH] Remove unused Event::clone method. --- tdactor/td/actor/impl/Event.h | 19 ------------------- tdutils/td/utils/Closure.h | 19 ------------------- 2 files changed, 38 deletions(-) diff --git a/tdactor/td/actor/impl/Event.h b/tdactor/td/actor/impl/Event.h index 32270e09a..a0e4d39fb 100644 --- a/tdactor/td/actor/impl/Event.h +++ b/tdactor/td/actor/impl/Event.h @@ -49,7 +49,6 @@ class CustomEvent { virtual ~CustomEvent() = default; virtual void run(Actor *actor) = 0; - virtual CustomEvent *clone() const = 0; virtual void start_migrate(int32 sched_id) { } virtual void finish_migrate() { @@ -62,9 +61,6 @@ class ClosureEvent final : public CustomEvent { void run(Actor *actor) final { closure_.run(static_cast(actor)); } - CustomEvent *clone() const final { - return new ClosureEvent(closure_.clone()); - } template explicit ClosureEvent(ArgsT &&...args) : closure_(std::forward(args)...) { } @@ -93,10 +89,6 @@ class LambdaEvent final : public CustomEvent { void run(Actor *actor) final { f_(); } - CustomEvent *clone() const final { - LOG(FATAL) << "Not supported"; - return nullptr; - } template , LambdaEvent>::value, int> = 0> explicit LambdaEvent(FromLambdaT &&lambda) : f_(std::forward(lambda)) { } @@ -181,17 +173,6 @@ class Event { destroy(); } - Event clone() const { - Event res; - res.type = type; - if (type == Type::Custom) { - res.data.custom_event = data.custom_event->clone(); - } else { - res.data = data; - } - return res; - } - bool empty() const { return type == Type::NoType; } diff --git a/tdutils/td/utils/Closure.h b/tdutils/td/utils/Closure.h index 999c9de1a..6c895c68e 100644 --- a/tdutils/td/utils/Closure.h +++ b/tdutils/td/utils/Closure.h @@ -94,10 +94,6 @@ class DelayedClosure { using ActorType = ActorT; using Delayed = DelayedClosure; - DelayedClosure clone() const { - return do_clone(*this); - } - explicit DelayedClosure(ImmediateClosure &&other) : args(std::move(other.args)) { } @@ -128,21 +124,6 @@ class DelayedClosure { std::abort(); } - template - std::enable_if_t::value...>::value, - DelayedClosure> - do_clone(const DelayedClosure &value) const { - LOG(FATAL) << "Trying to clone DelayedClosure that contains noncopyable elements"; - std::abort(); - } - - template - std::enable_if_t::value...>::value, - DelayedClosure> - do_clone(const DelayedClosure &value) const { - return DelayedClosure(value); - } - public: auto run(ActorT *actor) -> decltype(mem_call_tuple(actor, std::move(args))) { return mem_call_tuple(actor, std::move(args));