File indexing completed on 2025-09-17 08:02:04
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include <format>
0012 #include <sstream>
0013 #include <string_view>
0014
0015 namespace Acts::detail {
0016
0017 template <typename Char>
0018 struct BasicOstreamFormatter
0019 : std::formatter<std::basic_string_view<Char>, Char> {
0020 template <typename T, typename OutputIt>
0021 auto format(const T& value, std::basic_format_context<OutputIt, Char>& ctx)
0022 const -> OutputIt {
0023 std::basic_stringstream<Char> ss;
0024 ss << value;
0025 return std::formatter<std::basic_string_view<Char>, Char>::format(ss.view(),
0026 ctx);
0027 }
0028 };
0029
0030 using OstreamFormatter = BasicOstreamFormatter<char>;
0031
0032 }
0033
0034 #define ACTS_OSTREAM_FORMATTER(type) \
0035 template <> \
0036 struct std::formatter<type> : Acts::detail::OstreamFormatter {}