9#include "../microfmt.hpp"
20template <
typename T,
size_t N>
struct vec_view {
28template <
typename T,
size_t N> [[nodiscard]]
constexpr auto vec(
const T (&arr)[N])
noexcept {
32template <
typename T> [[nodiscard]]
constexpr auto vec3(
const T &x,
const T &y,
const T &z)
noexcept {
37 microfmt::string_view forwarded_spec{
""};
45 elem_fmt.parse(elem_ctx);
47 for (
size_t i = 0; i < v.data.size(); ++i) {
50 elem_fmt.format(v.data[i], out);
57 microfmt::string_view forwarded_spec{
""};
65 elem_fmt.parse(elem_ctx);
67 for (
size_t i = 0; i < 3; ++i) {
70 RELOCO_BEGIN_UNSAFE_BUFFER_USAGE;
71 elem_fmt.format(v.values[i], out);
72 RELOCO_END_UNSAFE_BUFFER_USAGE;
82template <
typename T,
size_t Rows,
size_t Cols>
struct matrix_view {
86template <
typename T,
size_t Rows,
size_t Cols> [[nodiscard]]
constexpr auto mat(
const T (&arr)[Rows * Cols])
noexcept {
91 microfmt::string_view forwarded_spec{
""};
99 elem_fmt.parse(elem_ctx);
101 for (
size_t r = 0; r < Rows; ++r) {
103 for (
size_t c = 0; c < Cols; ++c) {
106 elem_fmt.format(m.data[r * Cols + c], out);
Definition microfmt.hpp:881
reloco::sink sink
Type-erased, zero-allocation output sink.
Definition microfmt.hpp:46
constexpr auto vec3(const T &x, const T &y, const T &z) noexcept
Definition math.hpp:32
constexpr auto vec(const T(&arr)[N]) noexcept
Definition math.hpp:28
constexpr auto mat(const T(&arr)[Rows *Cols]) noexcept
Definition math.hpp:86
span< const T > data
Definition math.hpp:83
T values[3]
Definition math.hpp:25
span< const T > data
Definition math.hpp:21