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

Class FormatString

09.12-fixedString2/main.cpp:21–30  ·  view source on GitHub ↗

#A Takes the fixed string as NTTP

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected