Boost C++ Libraries: Ticket #678: bug in boost:format https://svn.boost.org/trac10/ticket/678 <pre class="wiki">Hello, software configuration: boost 1.33.1 stlport 5.0 example: std::string ret = boost::str(boost::format("%1%") % std::string("")); If you try to send as first argument the empty string to %-operator then you catch assertion failure in stl code: STLport-5.0.0\stlport\stl/debug/_string.h(308): STL error : Invalid argument to operation (see operation documentation) STLport-5.0.0\stlport\stl/debug/_string.h(308): STL assertion failure: (__s != 0) The null-pointer argument is passed from this: boost/boost/format/feed_args.hpp namespace boost { namespace io { namespace detail { template&lt;class Ch, class Tr, class Alloc&gt; void mk_str( std::basic_string&lt;Ch,Tr, Alloc&gt; &amp; res, const Ch * beg, typename std::basic_string&lt;Ch,Tr,Alloc&gt;::size_type size, std::streamsize w, const Ch fill_char, std::ios_base::fmtflags f, const Ch prefix_space, // 0 if no space-padding bool center) // applies centered/left/right padding to the string [beg, beg+size[ // Effects : the result is placed in res. { typedef typename std::basic_string&lt;Ch,Tr,Alloc&gt;::size_type size_type; res.resize(0); if(w&lt;=0 || static_cast&lt;size_type&gt;(w) &lt;=size) { // no need to pad. res.reserve(size + !!prefix_space); if(prefix_space) res.append(1, prefix_space); res.append(beg, size); /// here "beg" is null } ... ////////////////////-------------------------- There is no assertion failure if you pass empty string as second argument, e.g. std::string ret = boost::str(boost::format("%1% %2%") % 2 % std::string("")); Best regards, Andrei Selikhanovich </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/678 Trac 1.4.3 joaquintides Fri, 07 Jul 2006 11:40:40 GMT status changed https://svn.boost.org/trac10/ticket/678#comment:1 https://svn.boost.org/trac10/ticket/678#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> <pre class="wiki">Logged In: YES user_id=911241 This bug has been reported in #1450260 and #1506914 and is currently corrected in the CVS: * trunk: feed_args.hpp revisions 1.39 and 1.30 * RC_1_34_0: feed_args.hpp revisions 1.28.6.1 and 1.28.6.2 Joaquín M López Muñoz Telefónica, Investigación y Desarrollo </pre> Ticket