25 lines
563 B
C++
25 lines
563 B
C++
#pragma once
|
|
|
|
#include <format>
|
|
#include <string>
|
|
|
|
namespace cpp26 {
|
|
|
|
struct Point {
|
|
int x;
|
|
int y;
|
|
};
|
|
|
|
[[nodiscard]] auto format_point(const Point& point) -> std::string;
|
|
[[nodiscard]] auto format_points(const Point& a, const Point& b) -> std::string;
|
|
|
|
} // namespace cpp26
|
|
|
|
template <>
|
|
struct std::formatter<cpp26::Point> : std::formatter<std::string> {
|
|
auto format(const cpp26::Point& point, std::format_context& ctx) const {
|
|
return std::formatter<std::string>::format(
|
|
std::format("({}, {})", point.x, point.y), ctx);
|
|
}
|
|
};
|