AVasK / fmt

Compile-time Checked String Formatting for C++14 (GCC/Clang)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FMT

Enables Compile-Time Checked Formatting

Compiler Support

Needs the string literal operator templates [-Wgnu-string-literal-operator-template] and at least C++14 compliant compiler. Supported:

  • GCC
  • Clang

Syntax

// Positional:
auto formatted = "your {1} go {0}"_f("here", "args");
//or 
std::cout << "{0} is {2} better"_f("this", "actually", "much");

// Sequential: [to be supported soon, ~since is an easier version, but need to optimize~]

Syntax is checked at compile-time. Missed a brace? Won't compile. Trying to output an out-of-bounds argument? Won't compile with a nice (well... kinda, if you think the static_assert is nice, that is) error message. [In the next version]: Wrong format specifiers are also compile-time checked.

About

Compile-time Checked String Formatting for C++14 (GCC/Clang)


Languages

Language:C++ 100.0%