RE: [C++-sig] Re: Arbitrary argument lists, Python style?
David Abrahams sez:
"Conan Brink" <conanb@STCG.net> writes:
Forgive me if I'm just being dense [snip]
class BackCaller: def SetCallback(self, action, *args): self.cb = (action, args) def CallItBack(self): if self.cb: (action, args) = self.cb return action(*args)
The thing that's causing me to pull foot-long hairs from my head is that little *args
Does http://tinyurl.com/ibc6 help?
It does somewhat, but not to the extent that I was hoping for. raw_function, of course, only wants an unbound function, not a member of a class. If I try to give it a class member, g++ 3.2 is more than pleased to give me the error messages you might expect about how one must use .* or ->* to call pointer-to-member function. Are there plans for a raw_method or something similar that I can use for wrapping a C++ class's member functions for this, or should I just go with the Python wrapper approach? Might be nice if the published version on www.boost.org included the documentation for raw_function.hpp (I get 404 errors for http://www.boost.org/libs/python/doc/v2/raw_function.html, which is linked from http://www.boost.org/libs/python/doc/v2/reference.html). -Conan This message contains information that may be confidential and privileged. Unless you are the addressee (or authorized to receive messages for the addressee), you may not use, copy, or disclose to anyone the message or any information contained in the message. If you have received the message in error, please advise the sender by reply e-mail and delete the message. Nothing in this message should be interpreted as a digital or electronic signature that can be used to authenticate a contract or any other legal document.
"Conan Brink" <conanb@STCG.net> writes:
David Abrahams sez:
"Conan Brink" <conanb@STCG.net> writes:
Forgive me if I'm just being dense [snip]
class BackCaller: def SetCallback(self, action, *args): self.cb = (action, args) def CallItBack(self): if self.cb: (action, args) = self.cb return action(*args)
The thing that's causing me to pull foot-long hairs from my head is that little *args
Does http://tinyurl.com/ibc6 help?
It does somewhat, but not to the extent that I was hoping for.
raw_function, of course, only wants an unbound function, not a member of a class.
If I try to give it a class member, g++ 3.2 is more than pleased to give me the error messages you might expect about how one must use .* or ->* to call pointer-to-member function.
Are there plans for a raw_method or something similar that I can use for wrapping a C++ class's member functions for this, or should I just go with the Python wrapper approach?
whatever raw_foo_bar(tuple args, dict kw) { return extract<foo&>(args[0])().bar(args.slice(1,_), kw); }
Might be nice if the published version on www.boost.org included the documentation for raw_function.hpp (I get 404 errors for http://www.boost.org/libs/python/doc/v2/raw_function.html, which is linked from http://www.boost.org/libs/python/doc/v2/reference.html).
OK, I'll upload it. -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (2)
-
Conan Brink -
David Abrahams