[C++-sig] Re: Naming arguments of exported methods

David Abrahams dave at boost-consulting.com
Wed Oct 29 01:45:00 CET 2003


Pierre Barbier de Reuille <pierre.barbier at cirad.fr> writes:

> I'm trying to use the "arg" object as descibed in the CVS documentation
> in "libs/python/doc/v2/args.html" (in your boost directory). It says not
> to use args. But I cannot succeed in making it compile with g++-3.2
> Instead, I have the errors put at the end of the text. For all these
> errors, I just modified the line :
>
> 	.def( "neighbors", cg3d_neighbors)
>
> into :
>
> 	.def( "neighbors", cg3d_neighbors , py_arg( "cell" ) )

It's a bug, which the enclosed patch fixes (yes, I'm checking it in,
nobody needs to ask me).

> I should add that I needed to define:
>
> typedef boost::python::arg py_arg;
>
> because 'arg' is already used in the STL and in boost itself. I hope
> there is enough details.

That's only because you've written using-directives to bring all those
namespaces in without qualification (a bad idea).  You can get around
the problem by adding

    using boost::python::arg;

inside your module initialization function.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: args.patch
Type: text/x-patch
Size: 5576 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20031028/0096768c/attachment.bin>
-------------- next part --------------


-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com


More information about the Cplusplus-sig mailing list