sabel83 / mpllibs

C++ template metaprogramming library collection
http://abel.web.elte.hu/mpllibs
126 stars 16 forks source link

safe_printf feature request #3

Open rockeet opened 10 years ago

rockeet commented 10 years ago

I read and tested your safe_printf, it was amazed me... So, what I need is not only "safe", but also "convenient", for example, I want (maybe many people want too) such a features: When I write safe_printf<"%d %X %s">(10LL, 11L, std::string("abc")), my intention is really safe_printf<"%lld %lX %s">(10LL, 11L, std::string("abc").c_str()). In C++11, it is possible to convert the original format string with the intended one, so, we needn't to specify the redundant width format specifier and s.c_str() ect...

sabel83 commented 10 years ago

With safe_printf in its current form you can easily replace it with the original printf if you want to compile quickly. Extra type conversions based on the format string would not make it possible.

Some new placeholder notation could be added to the format string to express that printf should detect the type of the argument and use that.