Problems on using ostringstream with boost.format and boost.xpressive

Hi, the following code did not work as expected: --8<--- #include <iostream> #include <sstream> #include <boost/format.hpp> #include <boost/xpressive/xpressive.hpp> using namespace boost::xpressive; int main() { std::string input( "the answer is\r42" ); const std::string f( "[Input]\n%1%\n|\n" ); std::ostringstream oss; #if 0 oss << boost::format( f ) % input ; #else oss << input; #endif sregex re = as_xpr("\r"); std::string format("\n"); std::ostream_iterator< char > out_iter( std::cout ); regex_replace( out_iter, oss.str().begin(), oss.str().end(), re, format ); } --->8--- The first version displays nothings, the second adds garbage around the text and prints the input string twice. Does exist some limitations or did I ignore some basics? Thanks, Olaf
participants (1)
-
Olaf Peter