[C++-sig] question about object

Brian O'Kennedy brokenn at gmail.com
Wed Sep 1 09:41:13 CEST 2010

I'm guessing it's the boost python equivalent of the Python code:
>>> "%s is bigger than %s" % (NAME,name)

The c++ statement is doing the same, via operator overloading. If we look at
the statement bit-by-bit:

object msg="%s is bigger than %s" % make_tuple(NAME,name);
Creating a boost python object called 'msg' and assign the string "%s is
bigger than %s" to it.

object msg="%s is bigger than %s" % make_tuple(NAME,name);
The '%' operator is overloaded by boost python to work the same as in

object msg="%s is bigger than %s" % make_tuple(NAME,name);

Create a tuple of NAME,name and pass that to the '%' operator.


On 31 August 2010 22:46, Junwei Zhang <junweizhang2006 at gmail.com> wrote:

> Hi all,
> who can tell me what c++ semantics of following  statement.
> I do not understand it, it do not like usual c++ codes
> object msg="%s is bigger than %s" %make_tuple(NAME,name);
> --
> Junwei Zhang
> Office Phone:402-472-1968
> junweizhang2006 at gmail.com
> www.junweizhang.com
> Department of Electrical Engineering
> University of Nebraska-Lincoln
> 209N Walter Scott Engineering Center
> P.O. Box 880511
> Lincoln, NE 68588-0511
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20100901/2ae028f6/attachment.html>

More information about the Cplusplus-sig mailing list