RE: [boost] Re: Formal review of "Output Formatters" library beginstoday

Vladimir Prus wrote:
There are some things I don't like. First, as many mentioned, the naming is not optimal. [snip] or maybe even
("[" + io(v)/"," + "]")
for nested formats, something like
("[" + io::format( "(" + io::format()/":" + ")" )/"," + "]" )
These are just ideas, though.
In my development version, I now have this working! That is, you can do: std::cout << io::object ( std::make_pair( 'a', 5 ), "{ " + fmt::pair()/" == " + " }" ) << '\n'; // output: { a == 5 } and: std::cout << io::object ( std::make_pair( std::make_pair( 'a', 1 ), std::make_pair( 'b', 2 )), "{ " + fmt::pair ( "< " + fmt::pair()/" + " + " >", "( " + fmt::pair()/" | " + " )" )/" = " + " }" ) << '\n'; // output: { < a + 1 > = ( b | 2 ) } I have tested with VC 7.x and 8.0. VC7.0 has some problems, but the others build it fine. Regards, Reece _________________________________________________________________ Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo

Reece Dunn wrote:
Vladimir Prus wrote:
There are some things I don't like. First, as many mentioned, the naming is not optimal. [snip] or maybe even
("[" + io(v)/"," + "]")
for nested formats, something like
("[" + io::format( "(" + io::format()/":" + ")" )/"," + "]" )
These are just ideas, though.
In my development version, I now have this working! That is, you can do:
std::cout << io::object ( std::make_pair( 'a', 5 ), "{ " + fmt::pair()/" == " + " }" ) << '\n'; // output: { a == 5 }
Great. I wonder what others think? Personally, I really like the / operator. Probably that's because I've borrowed the idea from one parser generator which allows to write: (literal / "," ) to mean a list of literals separated by ",". The opening and closing braces look less clear for me now. Maybe, we can use fmt::pair("{", "}")/" == " or fmt::braces("{", "}") + fmt::pair()/" == " But I'm really really not sure. - Volodya
participants (2)
-
Reece Dunn
-
Vladimir Prus