Boost logo

Boost :

From: Rainer Deyke (root_at_[hidden])
Date: 2002-02-09 17:59:08


----- Original Message -----
From: "Andrei Alexandrescu" <andrewalex_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Saturday, February 09, 2002 1:43 PM
Subject: Re: [boost] Boost.Format syntax

> By the way, I'm not sure whether this was pointed out so far -

It has.

> operator% is
> used by Python for formatting. That's what one could call a
"precedent".

Yes, but Python's formatting operator takes a string as the lhs and
either a single value or a (comma-constructed) tuple of values for the
rhs. The result is terser than anything C++ has to offer. Compare:

  "%s %s." % ("Hello", "world") # Python
  format("%s %s.") % "Hello" % "world" // C++

I personally don't see the point of using both a function and an
operator. Python just uses an operator. If this is not possible in
C++, the C++ form should just use a function.

--
Rainer Deyke | root_at_[hidden] | http://rainerdeyke.com

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