fix move/copy correctness

This commit is contained in:
Francisco Paisana 2020-03-30 10:36:31 +01:00 committed by Francisco Paisana
parent be5a33f9b7
commit 7c76a64238
1 changed files with 3 additions and 9 deletions

View File

@ -53,11 +53,11 @@ struct state_name_visitor {
template <typename TargetVariant, typename PrevState>
struct variant_convert {
template <typename State>
void operator()(State&& s)
void operator()(State& s)
{
static_assert(not std::is_same<typename std::decay<State>::type, typename std::decay<PrevState>::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;
};