Add std::format formatter for ecs::handle
This commit is contained in:
parent
57f9f7331c
commit
8099e928dc
1 changed files with 15 additions and 0 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
#include <psemek/ecs/detail/id.hpp>
|
#include <psemek/ecs/detail/id.hpp>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <format>
|
||||||
|
|
||||||
namespace psemek::ecs
|
namespace psemek::ecs
|
||||||
{
|
{
|
||||||
|
|
@ -46,4 +47,18 @@ namespace std
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename Char>
|
||||||
|
struct formatter<::psemek::ecs::handle, Char>
|
||||||
|
{
|
||||||
|
constexpr auto parse(std::format_parse_context & ctx)
|
||||||
|
{
|
||||||
|
return ctx.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto format(::psemek::ecs::handle const & handle, std::format_context & ctx) const
|
||||||
|
{
|
||||||
|
return std::format_to(ctx.out(), "({},{})", handle.id, handle.epoch);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue