#pragma once #include "deimos/core/base.h" namespace deimos { class IWriter; struct FormatArg { enum Type : uint8_t { kInteger, kUnsignedInteger, kString, }; Type type; union { int64_t integer; uint64_t unsigned_integer; StringView string; }; explicit FormatArg(std::signed_integral auto value) : type{kInteger}, integer{value} {} explicit FormatArg(std::unsigned_integral auto value) : type{kUnsignedInteger}, unsigned_integer{value} {} explicit FormatArg(StringView value) : type{kString}, string{value} {} }; template concept Formattable = requires (T value) { FormatArg(value); }; void FormatVa(IWriter*, gsl::czstring fmt, Span); template void Format(IWriter* writer, gsl::czstring fmt, Args&&... args) { FormatVa(writer, fmt, { FormatArg(std::forward(args))... }); } } // namespace deimos