#pragma once #include #include namespace floormat { using namespace fmt::literals; template std::size_t snformat(char(&buf)[N], Fmt&& fmt, Xs&&... args) { constexpr std::size_t n = N > 0 ? N - 1 : 0; auto result = fmt::format_to_n(buf, n, std::forward(fmt), std::forward(args)...); const auto len = std::min(n, result.size); if constexpr(N > 0) buf[len] = '\0'; return len; } } // namespace floormat