#A Takes the fixed string as NTTP
| 20 | |
| 21 | template<fixed_string Str> // #A Takes the fixed string as NTTP |
| 22 | struct FormatString { |
| 23 | static constexpr auto fmt = |
| 24 | Str; // #B Store the string for easy access |
| 25 | |
| 26 | // #C Use ranges to count all the percent signs. |
| 27 | static constexpr auto numArgs = |
| 28 | std::ranges::count(fmt.data, '%'); |
| 29 | |
| 30 | // #D For usability provide a conversion operator |
| 31 | operator const auto *() const { return fmt.data; } |
| 32 | }; |
| 33 | |
| 34 | template<fixed_string Str> |
| 35 | constexpr auto operator"" _fs() |
nothing calls this directly
no outgoing calls
no test coverage detected