$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-users] Boost.Format to a string
From: John M. Dlugosz (mpbecey7gu_at_[hidden])
Date: 2011-06-26 19:25:04
I brought this up a while back, and I ran into it again yesterday. Using boost::format to
produce a string, as opposed to sending it directly to cout, is awkward.
boost::format ("blah blah blah") % exp1 % exp2 %exp3
is fine in and of itself. But then what? You need to wrap the whole thing in extra
parens to use str:
std::string s= (boost::format ("blah blah blah") % exp1 % exp2 %exp3).str();
WHY NOT allow implicit conversion to string?
Or, some other mechanism that doesn't complicate the expression and bury the interesting part?
âJohn