Re: [C++-sig] Pyste bug - static member functions...
by Nicodemus other posts by this author
Jun 17 2003 6:56AM messages near this date
Re: [C++-sig] Re: Pyste bug - static member functions...
|
RE: [C++-sig] Automatic downcast question
Roman Sulzhyk wrote:
> Nicodemus:
>
> Another thing I've noticed, that for static member functions the code
> generated defines them in class scope instead of global scope, causing
> errors.
>
> Basically, you need to change the 'PointerDeclaration' of Method class
> to look more like this:
>
>
> # If a method is static, don't need the class specifier
> if self.static:
> scope = '*'
> else:
> scope = '%s::*' % self.class_
>
>
> if self.const:
> const = 'const'
> return '(%s (%s)(%s) %s)&%s' %> (result, scope, params, const, self.Full
Name())
>
> That fixes the problem.
>
>
You do not seem to be using the latest CVS, Pyste uses staticmethod to
declare static member functions:
struct C
{
static int foo() { return 0; }
};
// Module
======================================================================
BOOST_PYTHON_MODULE(test)
{
class_< C > ("C", init< >())
.def(init< const C & > ())
.def("foo", &C::foo)
.staticmethod("foo")
;
}
If you are not using the latest CVS, then I might be misunderstanding
the problem, but I *stronly* suggest that you use the latest CVS from
both Boost.Python and Pyste... Pyste specifically has had lots of bug
fixes and some new features since the 1.30.0 release of Boost. ;)
> I also like Dave's suggestion to use the term 'final' to denote virtual
> functions that are not expected to be overloadable from Python.
>
>
I considered it too, but I thought that "no_override" was more clear.
What you guys think?
Regards,
Nicodemus.
_______________________________________________
C++-sig mailing list
C++-sig@[...].org
http://mail.python.org/mailman/listinfo/c++-sig
Thread:
David Abrahams
David Abrahams
Brett Calcott
Brett Calcott
David Abrahams
Brett Calcott
Brett Calcott
Joel de Guzman
David Abrahams
David Abrahams
Dirk Gerrits
David Abrahams
David Abrahams
Brett Calcott
Joel de Guzman
Nicodemus
David Abrahams
Roman Sulzhyk
David Abrahams
Nicodemus
Roman Sulzhyk
Nicodemus
David Abrahams
Nicodemus
Roman Sulzhyk
Nicodemus
Roman Sulzhyk
Nicodemus
David Abrahams
Nicodemus
Roman Sulzhyk
Ralf W. Grosse-Kunstleve
Nicodemus
|