move std function

This commit is contained in:
2026-03-20 16:31:30 +03:00
parent 4537e40832
commit 96c22e1184
28 changed files with 145 additions and 131 deletions
@@ -5,8 +5,8 @@
//! \~russian Объявляет состояния, используемые в PIStateMachine
/*
PIP - Platform Independent Primitives
State machine node
Ivan Pelipenko peri4ko@yandex.ru
State machine node
Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@@ -196,10 +196,10 @@ class PIP_EXPORT PIStateLambda: public PIStateBase {
public:
//! \~english Creates a state backed by enter and exit callbacks.
//! \~russian Создает состояние с callback-функциями входа и выхода.
PIStateLambda(std::function<void()> on_enter, std::function<void()> on_exit = nullptr, const PIString & n = {}): PIStateBase(n) {
enter = on_enter;
exit = on_exit;
}
PIStateLambda(std::function<void()> on_enter, std::function<void()> on_exit = nullptr, const PIString & n = {})
: PIStateBase(n)
, enter(std::move(on_enter))
, exit(std::move(on_exit)) {}
//! \~english Executes the enter callback.
@@ -228,9 +228,8 @@ class PIP_EXPORT PIStateFinal: public PIStateBase {
public:
//! \~english Creates a final state with an optional callback executed on entry.
//! \~russian Создает финальное состояние с необязательной callback-функцией, выполняемой при входе.
PIStateFinal(std::function<void()> on_finish = nullptr, const PIString & n = {}): PIStateBase(n) {
PIStateFinal(std::function<void()> on_finish = nullptr, const PIString & n = {}): PIStateBase(n), enter(std::move(on_finish)) {
is_final = true;
enter = on_finish;
}