Boost logo

Boost :

From: Samuel Krempp (krempp_at_[hidden])
Date: 2002-01-21 04:41:03


On Mon, 2002-01-21 at 01:43, Beman Dawes wrote:
> Is the only remaining objection the need for the constructor below to
> be repeated for each possible number of arguments?

well, personnally it is my only objection.
Tom becker sample codes shows that the choice of this function call
interface is independant from the rest of the library (just
like the choice of operator% vs operator().. )

> template<typename T1>
> format(const char* s, T1 a1) : s_(s)
> {
> push_arg(&a1);
> }

'push_arg' can be replaced by 'operator%' and then
the template constructors could be adapted over any operator-oriented
format class to
provide a function-call interface.

We can provide both a function-call interface (with limited number of
arguments),
and the operator-call interface.

the only inconvenience I see with this, is it will make yet another
'two cases' documentation, eg :
"""
You can either call
cout << format("%1 %2", x, y) ;

or
cout << format("%1 %2") % x % y;
"""

hum, this should not confuse the users much, so I think the function
interface would be a good feature to add.

-- 
Sam

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk