Boost logo

Boost :

From: (noreply_at_[hidden])
Date: 2006-07-07 06:07:38

Bugs item #1518640, was opened at 2006-07-07 13:07
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: function
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: AndreiMS (andreims)
Assigned to: Douglas Gregor (dgregor)
Summary: bug in boost:format

Initial Comment:

software configuration:
boost 1.33.1
stlport 5.0

std::string ret = boost::str(boost::format("%1%") %

If you try to send as first argument the empty string
to %-operator then you catch assertion failure in stl

STLport-5.0.0\stlport\stl/debug/_string.h(308): STL
error : Invalid argument to operation (see operation
STLport-5.0.0\stlport\stl/debug/_string.h(308): STL
assertion failure: (__s != 0)

The null-pointer argument is passed from this:


namespace boost {
namespace io {
namespace detail {

    template<class Ch, class Tr, class Alloc>
    void mk_str( std::basic_string<Ch,Tr, Alloc> &
                 const Ch * beg,
std::basic_string<Ch,Tr,Alloc>::size_type size,
                 std::streamsize w,
                 const Ch fill_char,
                 std::ios_base::fmtflags f,
                 const Ch prefix_space, // 0 if no
                 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<Ch,Tr,Alloc>::size_type size_type;
        if(w<=0 || static_cast<size_type>(w) <=size) {
            // no need to pad.
            res.reserve(size + !!prefix_space);
              res.append(1, prefix_space);
            res.append(beg, size); /// here "beg" is


There is no assertion failure if you pass empty string
as second argument,
std::string ret = boost::str(boost::format("%1% %2%")
% 2 % std::string(""));

Best regards,
          Andrei Selikhanovich


You can respond by visiting:

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
Boost-bugs mailing list

Boost list run by bdawes at, gregod at, cpdaniel at, john at