[format] Alternative syntax
Hi folks, Any interest in the alternative syntax for boost::format? format2 f("Hello %s, %s"); std::cout << f("Joe", "Jane") << std::endl << f("Jose", "Mary") << std::endl; Which creates the output; Hello Joe, Jane Hello Jose, Mary Code is available at http://bit.ly/2J60Re for any suggessions. Take care, emre
AMDG Emre Turkay wrote:
Any interest in the alternative syntax for boost::format?
format2 f("Hello %s, %s"); std::cout << f("Joe", "Jane") << std::endl << f("Jose", "Mary") << std::endl;
Which creates the output;
Hello Joe, Jane Hello Jose, Mary
Code is available at http://bit.ly/2J60Re for any suggessions.
Why is this syntax better? In Christ, Steven Watanabe
On Wed, Jul 29, 2009 at 1:33 PM, Steven Watanabe
AMDG
Emre Turkay wrote:
Any interest in the alternative syntax for boost::format?
format2 f("Hello %s, %s"); std::cout << f("Joe", "Jane") << std::endl << f("Jose", "Mary") << std::endl;
Which creates the output;
Hello Joe, Jane Hello Jose, Mary
Code is available at http://bit.ly/2J60Re for any suggessions.
Why is this syntax better?
I like that syntax, and I can see how it could be better in that it would have better caching (does not need to recreate the object, which is very slow), and it is a more simple syntax then the normal way you can cache it. Looks nice to me.
Hi, On Wed, Jul 29, 2009 at 06:16:19PM -0600, OvermindDL1 wrote:
I like that syntax, and I can see how it could be better in that it would have better caching (does not need to recreate the object, which is very slow), and it is a more simple syntax then the normal way you can cache it. Looks nice to me.
Well, thanks. Apparently, removing the extra copy of the boost::format object does not change the functionality, so it is removed. Take care, emre
Hi, On Wed, Jul 29, 2009 at 12:33:33PM -0700, Steven Watanabe wrote:
Why is this syntax better?
In Christ, Steven Watanabe
format f1("%s, %s"); string s1 = (f1 % arg1 % arg2).str(); format2 f2("%s, %s"); string s2 = f2(arg1, arg2); I don't claim it's better in general, the first case is better in places where you need to bind the arguments one by one. And I think the second case is easier to read and understand and therefore it is better in places where you can bind all the arguments at once and need the formatted string immediately. Take care, emre
participants (3)
-
Emre Turkay
-
OvermindDL1
-
Steven Watanabe