CDT++ 1.0.0
Causal Dynamical Triangulations in C++
Loading...
Searching...
No Matches
Formatters.hpp
Go to the documentation of this file.
1/*******************************************************************************
2 Causal Dynamical Triangulations in C++ using CGAL
3
4 Copyright © 2025 Adam Getchell
5 ******************************************************************************/
6
11
12#ifndef CDT_PLUSPLUS_FORMATTERS_HPP
13#define CDT_PLUSPLUS_FORMATTERS_HPP
14
15#include <fmt/core.h>
16#include <fmt/format.h>
17
18#include <sstream>
19
21
22namespace fmt
23{
25 template <typename Kernel>
26 struct formatter<CGAL::Point_3<Kernel>>
27 {
31 constexpr auto parse(format_parse_context& ctx) -> decltype(ctx.begin())
32 { return ctx.begin(); }
33
39 template <typename FormatContext>
40 auto format(CGAL::Point_3<Kernel> const& point, FormatContext& ctx) const
41 -> decltype(ctx.out())
42 {
43 std::stringstream ss;
44 ss << point;
45 return fmt::format_to(ctx.out(), "{}", ss.str());
46 }
47 };
48} // namespace fmt
49
50#endif // CDT_PLUSPLUS_FORMATTERS_HPP
Traits class for particular uses of CGAL.
auto format(CGAL::Point_3< Kernel > const &point, FormatContext &ctx) const -> decltype(ctx.out())
Format a point using its stream insertion representation.
constexpr auto parse(format_parse_context &ctx) -> decltype(ctx.begin())
Accept only the default point format specification.