Last active
May 6, 2017 00:30
-
-
Save yashihei/9927672e2eecf776a368ab25cbe2e6b4 to your computer and use it in GitHub Desktop.
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 <winbase.h> | |
#include <boost/format.hpp> | |
inline void Log(boost::format &bfmt) { | |
#if defined(_DEBUG) | |
OutputDebugString(bfmt.str().c_str()); | |
#endif | |
} | |
template<class First, class... Rest> | |
inline void Log(boost::format &bfmt, const First& first, const Rest&... rest) { | |
Log(bfmt % first, rest...); | |
} | |
template<class... Rest> | |
inline void Log(const std::string& fmt, const Rest&... rest) { | |
boost::format bfmt(fmt); | |
Log(bfmt, rest...); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
参考元 https://raw.githubusercontent.com/yohshiy/programmers_notes/master/lang/cpp/args/safe_printf.cpp