Helios Engine
A modular ECS based data-oriented C++23 game engine framework
Loading...
Searching...
No Matches
command.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <concepts>
4#include <type_traits>
5
6namespace helios::ecs {
7
8class World;
9
10/**
11 * @brief Concept that defines the requirements for a command trait.
12 * @details A command must be destructible, move or copy constructible,
13 * be an object, not polymorphic, and must have an `Execute` with signature
14 * `(helios::ecs::World&) -> void`.
15 * @tparam T The type to check for the command trait
16 */
17template <typename T>
18concept CommandTrait =
19 std::destructible<T> &&
20 (std::move_constructible<T> || std::copy_constructible<T>) &&
21 std::is_object_v<std::remove_cvref_t<T>> &&
22 !std::is_polymorphic_v<std::remove_cvref_t<T>> &&
23 requires(T command, helios::ecs::World& world) {
24 { command.Execute(world) } -> std::same_as<void>;
25 };
26
27} // namespace helios::ecs
The World class manages entities with their components and systems.
Definition world.hpp:39
Concept that defines the requirements for a command trait.
Definition command.hpp:18