An attempt to recreate the python format operator syntax as good as possible in modern C++
The syntax in question is this:
"foo%s %d" % ("bar", 42) # -> "foobar 42"- Make the syntax look as similar as possible.
- Pass the arguments to C's
printf-family functions. Do not reimplement the functionality (the challenge is about using the built in functions. Recreatingprintfas closely as possible would certainly also be an interesting challenge, but that's not what this about) - Convert
std::stringtochar*, so they can be used withprintf - Convert objects that can be streamed into an
std::ostreamintochar*as well
- Current syntax looks like
"foo%s %d" % _("bar", 42), which is impressively close, considering C++ doesn't have a raw list syntax. - This is currently the main issue. I haven't found a way to covert objects inside a container into multiple arguments or a
va_listobject - Blocked by 2, but should be fairly easy with template magic
- Same as 3