// { dg-do compile { target c++23 } } #include #include struct MyPair { int x; int y; }; template struct std::formatter { template auto parse(ParseContext& pc) { return _formatter.parse(pc); } template auto format(const MyPair& mp, FormatContext& fc) const { return _formatter.format(std::make_pair(mp.x, mp.y), fc); } private: std::formatter, CharT> _formatter; }; static_assert(std::formattable); static_assert(std::formattable); struct MyRange { int* begin; int* end; }; template struct std::formatter { template auto parse(ParseContext& pc) { return _formatter.parse(pc); } template auto format(const MyRange& mp, FormatContext& fc) const { return _formatter.format(std::span(mp.begin, mp.end), fc); } private: std::formatter, CharT> _formatter; }; static_assert(std::formattable); static_assert(std::formattable);