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