Created
February 17, 2017 23:48
-
-
Save crabtw/253bdfcb15535692711a0f894a5d0c7b to your computer and use it in GitHub Desktop.
format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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