[C++-sig] A couple of simple BP V2 questions

Scott A. Smith ssmith at magnet.fsu.edu
Wed Nov 13 18:28:38 CET 2002


> David wrote:

> How about return_value_policy<copy_const_reference>?
> Is it important to avoid copying the resulting string?

No, copying is fine. Use of return_value_policy<copy_const_reference>
did the job, I just didn't read through the reference manual far enough.

> Joel wrote:
> Scott. If there are some more things
> you wish from the tutorial, feel free to post them here. I'm taking notes
> and collecting a TODO list.

Just a few things as I go through the tutorial.

On this page

http://www.boost.org/libs/python/doc/tutorial/doc/default_arguments.html

there is a nice discussion as to how one deals with functions that have
default arguments. As for overloaded functions, things are a litte more
cryptic.
Where it says to use the described methods when the functions

"are overloaded with a common sequence of initial arguments"

I guess that indicates that

1.) The function return types are the same?
2.) The ordering of the arguments are very much the same
    i.e. (int), (int, string), (int, string, double)
    but then NOT (string,double,int)?
3.) If any overload is significantly dissimilar do not use this method?

If that is true, then I think the text should discuss overloaded functions a
little
better since many (most) overloads will have such dissimilarities. In such
cases
then I assume one must still use thin wrappers?

I think the page should have a link to the additional information in the
reference manual.

http://www.boost.org/libs/python/doc/v2/overloads.html#BOOST_PYTHON_FUNCTION
_OVERLOADS-spec

While the above reference page does show how to do overloads of the function
"f", but these
are quite different than dealing with say two different class Y member
functions named f that
have different argument types.  This is what I am trying to do at the moment
and, after quite a bit
of time trying to figure how out to use
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS I
have now decided that I must use thin wrappers?

Also, there is a small type on the above page which should probably be
fixed:

stryct Y {};

Regards,
Scott





More information about the Cplusplus-sig mailing list