From: Dan Nuffer (dnuffer_at_[hidden])
Date: 2001-06-29 14:16:00
Samuel Krempp wrote:
> > I find the usage:
> > format( format_string, arg1, arg2, ... )
> > to be more flexible than what you have proposed. Most of the time that
> > I use the format class, it isn't being sent to a stream. I've put an
> > "operator string" and a "const char* c_str() const" functions on it to
> > allow it to be passed to the logger and in constructors of exceptions.
> > It still has an "operator <<" to allow it to be inserted into streams,
> > if need be.
> well, as of now, my format will behave exactly the same if I define this
> conversion to string + c_str()
> (there is already a str() function, as seen in the example program)
> the "format-is-a-function" approach has big problems :
> . limited number of arguments. ("well, who cares..")
True, however, so far I've never hit that limit. Anyway, there is a
simple workaround: format("%1..%9", arg1,...,format("%1..."))
Just embed another format in the last argument. So it's not a real
limit, just kind of annoying (considering you even hit it).
> . if you want good passing of arguments (ie not copy by value, but
> passing T& / const T&),
> you need to define 2^10 functions.. (!)
You must know something I don't. With the version I've been using, all
arguments are passed to the constructor as const T&, and I've only got 9
constructors. Why do you need the non-const variations?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk