process: [[nodiscard]] (see #501)
This commit is contained in:
@@ -84,31 +84,31 @@ class process {
|
||||
|
||||
template<typename Target = Derived>
|
||||
auto next(integral_constant<state::UNINITIALIZED>)
|
||||
-> decltype(std::declval<Target>().init()) {
|
||||
-> decltype(std::declval<Target>().init(), void()) {
|
||||
static_cast<Target *>(this)->init();
|
||||
}
|
||||
|
||||
template<typename Target = Derived>
|
||||
auto next(integral_constant<state::RUNNING>, Delta delta, void *data)
|
||||
-> decltype(std::declval<Target>().update(delta, data)) {
|
||||
-> decltype(std::declval<Target>().update(delta, data), void()) {
|
||||
static_cast<Target *>(this)->update(delta, data);
|
||||
}
|
||||
|
||||
template<typename Target = Derived>
|
||||
auto next(integral_constant<state::SUCCEEDED>)
|
||||
-> decltype(std::declval<Target>().succeeded()) {
|
||||
-> decltype(std::declval<Target>().succeeded(), void()) {
|
||||
static_cast<Target *>(this)->succeeded();
|
||||
}
|
||||
|
||||
template<typename Target = Derived>
|
||||
auto next(integral_constant<state::FAILED>)
|
||||
-> decltype(std::declval<Target>().failed()) {
|
||||
-> decltype(std::declval<Target>().failed(), void()) {
|
||||
static_cast<Target *>(this)->failed();
|
||||
}
|
||||
|
||||
template<typename Target = Derived>
|
||||
auto next(integral_constant<state::ABORTED>)
|
||||
-> decltype(std::declval<Target>().aborted()) {
|
||||
-> decltype(std::declval<Target>().aborted(), void()) {
|
||||
static_cast<Target *>(this)->aborted();
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ public:
|
||||
* @brief Returns true if a process is either running or paused.
|
||||
* @return True if the process is still alive, false otherwise.
|
||||
*/
|
||||
bool alive() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] bool alive() const ENTT_NOEXCEPT {
|
||||
return current == state::RUNNING || current == state::PAUSED;
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ public:
|
||||
* @brief Returns true if a process is already terminated.
|
||||
* @return True if the process is terminated, false otherwise.
|
||||
*/
|
||||
bool dead() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] bool dead() const ENTT_NOEXCEPT {
|
||||
return current == state::FINISHED;
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ public:
|
||||
* @brief Returns true if a process is currently paused.
|
||||
* @return True if the process is paused, false otherwise.
|
||||
*/
|
||||
bool paused() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] bool paused() const ENTT_NOEXCEPT {
|
||||
return current == state::PAUSED;
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ public:
|
||||
* @brief Returns true if a process terminated with errors.
|
||||
* @return True if the process terminated with errors, false otherwise.
|
||||
*/
|
||||
bool rejected() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] bool rejected() const ENTT_NOEXCEPT {
|
||||
return stopped;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ class scheduler {
|
||||
};
|
||||
|
||||
template<typename Proc>
|
||||
static bool update(process_handler &handler, const Delta delta, void *data) {
|
||||
[[nodiscard]] static bool update(process_handler &handler, const Delta delta, void *data) {
|
||||
auto *process = static_cast<Proc *>(handler.instance.get());
|
||||
process->tick(delta, data);
|
||||
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
* @brief Number of processes currently scheduled.
|
||||
* @return Number of processes currently scheduled.
|
||||
*/
|
||||
size_type size() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] size_type size() const ENTT_NOEXCEPT {
|
||||
return handlers.size();
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
* @brief Returns true if at least a process is currently scheduled.
|
||||
* @return True if there are scheduled processes, false otherwise.
|
||||
*/
|
||||
bool empty() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] bool empty() const ENTT_NOEXCEPT {
|
||||
return handlers.empty();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user