Files
core_zero/tjp/core/string/sxprintf.h
Timothy Prepscius 996151a56a flatten 20260225
2026-02-25 12:43:06 -05:00

22 lines
589 B
C++
Executable File

// License: Modified MIT (NON-AI)
// See the LICENSE file in the root directory for license information.
// Copyright 2025 Timothy Prepscius
#pragma once
#include <cstdio>
#include <type_traits>
namespace tjp::core {
template<typename T, typename ... Args>
void sxprintf(T &t, const char *format, Args &&... args)
{
static_assert(std::is_array<T>::value, "T must be an array");
static_assert(std::is_same<typename std::remove_all_extents<T>::type, char>::value, "T must be an array of char");
snprintf(t, std::size(t), format, std::forward<Args>(args)...);
}
} // namespace