CDT++
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
22// Formatter specialization for CGAL::Point_3
23template <typename Kernel>
24struct fmt::formatter<CGAL::Point_3<Kernel>>
25{
26 // Format specification handling - keeping it simple for now
27 auto constexpr parse(format_parse_context& ctx) -> decltype(ctx.begin())
28 {
29 return ctx.begin();
30 }
31
32 // Format the point as a string with coordinates
33 template <typename FormatContext>
34 auto format(const CGAL::Point_3<Kernel>& point, FormatContext& ctx) const
35 -> decltype(ctx.out())
36 {
37 std::stringstream ss;
38 ss << point;
39 return fmt::format_to(ctx.out(), "{}", ss.str());
40 }
41};
42
43#endif // CDT_PLUSPLUS_FORMATTERS_HPP
Traits class for particular uses of CGAL.