id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 2777,find_format_all calls formatter with invalid match,Éric Malenfant ,Pavol Droba,"find_format_all() calls the formatter with an invalid match when the end of the input is reached. Example: {{{ // A Boost.StringAlgo Formatter expecting // to be called with matches to the regex: // (\d+\.)(\d+) struct NextVersionNumber { template std::string operator()(const RegexMatchT& M)const { // Without this check, we end up with // a bad_lexical_cast exception, // because operator() ends up being called twice: // First with a good match, and then with an emtpy one if (!Match){ return """"; } using boost::lexical_cast; return M.match_results()[1] + lexical_cast( lexical_cast(M.match_results()[2]) + 1 ); } }; int main() { namespace bsa = boost::algorithm; const std::string s(""version is 1.0""); // Outputs: // version is: 1.1 std::cout << bsa::find_format_all_copy( s, bsa::regex_finder(boost::regex(""(\\d+\\.)(\\d+)"")), NextVersionNumber() ); return 0; } }}} ",Bugs,closed,Boost 1.39.0,string_algo,Boost 1.35.0,Problem,fixed,,