[C++-sig] TypeError: bad argument type for built-in operation
David Abrahams
david.abrahams at rcn.com
Thu Jun 6 18:09:57 CEST 2002
I don't understand what result you expect; There is no get1() function
which accepts zero arguments.
----- Original Message -----
From: "Min Xu" <minxu at sci.ccny.cuny.edu>
To: <c++-sig at python.org>
Sent: Thursday, June 06, 2002 11:53 AM
Subject: [C++-sig] TypeError: bad argument type for built-in operation
> I am troubled by this error for a long time even for a simple code. Can
> anyone give me hints what is wrong here? Thanks.
>
> Output:
>
> % compiles OK.
> % python2.2 -c "import AA; print AA.AA().get1()"
-----------------------------------------------^^
> Traceback (most recent call last):
> File "<string>", line 1, in ?
> TypeError: bad argument type for built-in operation
>
>
> The simple code list:
>
> #include <boost/python/class.hpp>
> #include <boost/python/module.hpp>
> #include <boost/ref.hpp>
> #include <boost/utility.hpp>
> using namespace boost::python;
>
> class A
> {
> public:
> A() : x(0) {}
> virtual double get() = 0;
> virtual double get1(double x) = 0;
----------------------^^^^^^^^
> private:
> double x;
> };
>
>
> class AA : public A
> {
> public:
> AA() : A() {}
> double get() { return 0; }
> double get1(double x) { return x; }
--------------^^^^^^^^
> double get2(double x, double y) { return y+x; }
> };
>
More information about the Cplusplus-sig
mailing list