Initial Course
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#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);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user