24#ifndef STELLARLIB_ECS_COMMAND_QUEUE_HPP
25#define STELLARLIB_ECS_COMMAND_QUEUE_HPP
27#include <stellarlib/ecs/stack_vector.hpp>
28#include <stellarlib/ext/memory.hpp>
33namespace stellarlib::ecs::internal
35class command_queue final : ext::arena_allocator
39 command_queue() noexcept;
42 constexpr command_queue(const command_queue &) noexcept = delete;
45 command_queue(command_queue &&) noexcept;
47 constexpr auto operator=(const command_queue &) noexcept
48 -> command_queue & = delete;
50 auto operator=(command_queue &&) noexcept
53 ~command_queue() noexcept;
55 template <typename Callback>
56 constexpr
void enqueue(Callback &&callback) noexcept
59 [] (
auto callback)
noexcept ->
void {
60 (*
static_cast<Callback *
>(callback))();
61 std::destroy_at(
static_cast<const Callback *
>(callback));
67 void execute() noexcept;
72 void (*execute)(
void *)
noexcept;
76 stack_vector<command> _commands;
constexpr auto allocate() noexcept
Returns uninitialized memory for type T.
Definition memory.hpp:363