Format null ecs::handle as (none)
This commit is contained in:
parent
1265b816d3
commit
305d1556c2
1 changed files with 10 additions and 3 deletions
|
|
@ -29,7 +29,10 @@ namespace psemek::ecs
|
|||
|
||||
inline std::ostream & operator << (std::ostream & out, handle const & handle)
|
||||
{
|
||||
out << '(' << handle.id << ',' << handle.epoch << ')';
|
||||
if (!handle)
|
||||
out << "(none)";
|
||||
else
|
||||
out << '(' << handle.id << ',' << handle.epoch << ')';
|
||||
return out;
|
||||
}
|
||||
|
||||
|
|
@ -55,9 +58,13 @@ namespace std
|
|||
return ctx.begin();
|
||||
}
|
||||
|
||||
auto format(::psemek::ecs::handle const & handle, std::format_context & ctx) const
|
||||
template <typename FormatContext>
|
||||
auto format(::psemek::ecs::handle const & handle, FormatContext & ctx) const
|
||||
{
|
||||
return std::format_to(ctx.out(), "({},{})", handle.id, handle.epoch);
|
||||
if (!handle)
|
||||
return std::format_to(ctx.out(), "(none)");
|
||||
else
|
||||
return std::format_to(ctx.out(), "({},{})", handle.id, handle.epoch);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue