From 7c76a642380a0d4199502eaeb0711a302c323720 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Mon, 30 Mar 2020 10:36:31 +0100 Subject: [PATCH] fix move/copy correctness --- lib/include/srslte/common/fsm.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/include/srslte/common/fsm.h b/lib/include/srslte/common/fsm.h index 8f65691ca..33aa5c77e 100644 --- a/lib/include/srslte/common/fsm.h +++ b/lib/include/srslte/common/fsm.h @@ -53,11 +53,11 @@ struct state_name_visitor { template struct variant_convert { template - void operator()(State&& s) + void operator()(State& s) { static_assert(not std::is_same::type, typename std::decay::type>::value, "State cannot transition to itself.\n"); - *v = s; + *v = std::move(s); } TargetVariant* v; PrevState* p; @@ -138,13 +138,7 @@ struct fsm_helper { class state_t { public: - state_t() = default; - // // forbid copies, allow move - // state_t(const state_t&) = delete; - // state_t(state_t&&) noexcept = default; - // state_t& operator=(const state_t&) = delete; - // state_t& operator=(state_t&&) noexcept = default; - + state_t() = default; virtual const char* name() const = 0; };