Revert "Make fmt() non-recursive"
This reverts commit 2b761d5f50
.
Also *really* make fmt() take arguments by reference.
This commit is contained in:
parent
334b8f8af1
commit
603b2f583c
|
@ -161,7 +161,7 @@ template<typename... Args>
|
|||
inline void warn(const std::string & fs, const Args & ... args)
|
||||
{
|
||||
boost::format f(fs);
|
||||
nop{boost::io::detail::feed(f, args)...};
|
||||
formatHelper(f, args...);
|
||||
logger->warn(f.str());
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,16 @@ struct FormatOrString
|
|||
... a_n’. However, ‘fmt(s)’ is equivalent to ‘s’ (so no %-expansion
|
||||
takes place). */
|
||||
|
||||
inline void formatHelper(boost::format & f)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T, typename... Args>
|
||||
inline void formatHelper(boost::format & f, const T & x, const Args & ... args)
|
||||
{
|
||||
formatHelper(f % x, args...);
|
||||
}
|
||||
|
||||
inline std::string fmt(const std::string & s)
|
||||
{
|
||||
return s;
|
||||
|
@ -71,7 +81,7 @@ inline std::string fmt(const std::string & fs, const Args & ... args)
|
|||
{
|
||||
boost::format f(fs);
|
||||
f.exceptions(boost::io::all_error_bits ^ boost::io::too_many_args_bit);
|
||||
nop{boost::io::detail::feed(f, args)...};
|
||||
formatHelper(f, args...);
|
||||
return f.str();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue