1234567891011121314151617181920212223 |
- #include "boost/format.hpp"
- #include <iostream>
- template<class TFirst>
- void string_format(boost::format& fmt, TFirst&& first)
- {
- fmt% first;
- }
- template<class TFirst, class... TOther>
- void string_format(boost::format& fmt, TFirst&& first, TOther&&... other)
- {
- fmt% first;
- string_format(fmt, other...);
- }
- template<class TFirst, class... TOther>
- std::string string_format(const char* format, TFirst&& first, TOther&&... other)
- {
- boost::format fmt(format);
- string_format(fmt, first, other...);
- return fmt.str();
- }
|