[Boost-bugs] [ boost-Bugs-1506914 ] Still assertion failure in boost::format for empty strings

Bugs item #1506914, was opened at 2006-06-15 20:36 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1506914&group_id=7586 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: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Daniel Krügler (daniel_kruegler) Assigned to: Nobody/Anonymous (nobody) Summary: Still assertion failure in boost::format for empty strings Initial Comment: The assertion failure of boost::format in case of empty string arguments that occured since VS2005 has been partly fixed by cepstein in March 2006. This fix was partial, because there still exists a corner case, where this assertion can take place: #include <iostream> #include <ostream> #include <string> #include <boost/format.hpp> int main() { std::string arg; // empty string boost::format fmt = boost::format("%=8s") % arg; std::string s = fmt.str(); std::cout << s << std::endl; } The proposed patch looks in unified syntax: Index: feed_args.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/format/feed_args.hpp,v retrieving revision 1.29 diff -u -r1.29 feed_args.hpp --- feed_args.hpp 22 Mar 2006 15:13:25 -0000 1.29 +++ feed_args.hpp 15 Jun 2006 19:49:37 -0000 @@ -63,7 +63,8 @@ if(n_before) res.append(n_before, fill_char); if(prefix_space) res.append(1, prefix_space); - res.append(beg, size); + if (size) + res.append(beg, size); if(n_after) res.append(n_after, fill_char); } } // -mk_str(..) and in standard syntax: Index: feed_args.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/format/feed_args.hpp,v retrieving revision 1.29 diff -r1.29 feed_args.hpp 66c66,67 < res.append(beg, size); ---
if (size) res.append(beg, size);
---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1506914&group_id=7586 _______________________________________________ Boost-bugs mailing list Boost-bugs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/boost-bugs
participants (1)
-
SourceForge.net