Skip to content

Instantly share code, notes, and snippets.

@crabtw
Created February 17, 2017 23:48
Show Gist options
  • Save crabtw/253bdfcb15535692711a0f894a5d0c7b to your computer and use it in GitHub Desktop.
Save crabtw/253bdfcb15535692711a0f894a5d0c7b to your computer and use it in GitHub Desktop.
format
#include <cstdio>
#include <string>
struct Fmt {
operator const char *() {
return fmt.c_str();
}
std::string fmt;
};
Fmt fmtStr(const char *f) {
return Fmt{f};
}
int main() {
printf(fmtStr("%d"), 123);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment