|
Boost : |
From: Mike Sackett (msackett_at_[hidden])
Date: 2001-04-26 08:27:57
I think the problem is that you are casting to a pointer to member
function, instead of a simple pointer to function. The functions you are
trying to access are static, and so are not bound to an object instance.
I think if you change the .def calls to something like the following
you'll get past the compiler error:
hello_class.def((void (*)(void)) hello::over, "over");
hello_class.def((int (*)(int)) hello::over, "over");
..Mike
On Thu, 26 Apr 2001, gideon may wrote:
> Hi,
>
> I am just starting with the BPL (cool stuff) and came across
> the following problem.
> I have a C++ class with a number of overloaded static methods e.g. :
>
> // A friendly class.
> class hello
> {
> public:
> hello(const std::string& country) { this->country = country; }
> std::string greet() const { return "Hello from " + country; }
> static void over(void) { }
> static int over(int) { return 0; }
> private:
> std::string country;
> };
>
> When I try to generate the python binding with :
>
> hello_class.def((void (hello::*)(void)) hello::over, "over");
> hello_class.def((int (hello::*)(int)) hello::over, "over");
>
> the compiler barks both under Win2K MVC6, linux gcc and Irix/CC 7.3.
> It seems that the typecast for the hello::over function is not complete
> (missing static) but I am not able to put static in the typecast.
>
> Any idea on how to solve this without reverting to wrapper functions ?
>
>
> ciao, gideon
> Is there a way
>
>
> To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk