First
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "tl/detail/prologue.h"
|
||||
#include <EASTL/optional.h>
|
||||
#include <format>
|
||||
|
||||
namespace tl
|
||||
{
|
||||
using namespace eastl;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct std::formatter<tl::optional<T>>
|
||||
{
|
||||
constexpr auto parse(format_parse_context& ctx) noexcept { return ctx.begin(); }
|
||||
auto format(const tl::optional<T>& s, std::format_context& ctx) const
|
||||
{
|
||||
if (s.has_value())
|
||||
return format_to(ctx.out(), "{}", s.value());
|
||||
return format_to(ctx.out(), "<null>");
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user