MCPcopy Create free account
hub / github.com/andreasfertig/programming-with-cpp20 / FormatString

Class FormatString

09.04-fixedString1/main.cpp:28–38  ·  view source on GitHub ↗

#A Takes the fixed string as NTTP

Source from the content-addressed store, hash-verified

26
27template<fixed_string Str> // #A Takes the fixed string as NTTP
28struct 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
40template<fixed_string Str>
41constexpr auto operator"" _fs()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected