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
python.
object msg="%s is bigger than %s" % make_tuple(NAME,name);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Create a tuple of NAME,name and pass that to the '%' operator.
Cheers.
brian
On 31 August 2010 22:46, Junwei Zhang <[email protected]> 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
> [email protected]
> 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
> [email protected]
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>
_______________________________________________
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig