On 2011-07-05 11:57, Robert Parcus wrote:

I see that the template function approach is very useful for the number of value-types I have to work with (you guessed right), but I still have problems...

1) on the python interpreter, i have:
>>> fvec2
< class '_ext.fvec2' >
>>> int
< type 'int' >

Is there a standard way to make fvec2 become a real "type" in python, just like int?

What is fvec2 missing that makes you think it's not a "real type" ?


2) I still can't do this from python
>>> a = fvec2 (4.0,2.0)

I realise that what I may be missing is .def("__init__", ... ) somewhere, but I don't know where, and how to initialize it properly. (

That's right, you need to add appropriate constructors. I'm again not sure what specific issues you are facing, and what exactly doesn't work, making it hard to help. Have you followed the tutorial (http://www.boost.org/doc/libs/1_46_0/libs/python/doc/tutorial/doc/html/python/exposing.html#python.constructors) ?




Also, I had to exclude the "swizzle" part(last 2 lines of the first section), because otherwise the program would no compile, but that's not the important part right?

That was just meant to illustrate how to add member functions / methods to a class. I admit I didn't test the code I typed, so there may be typos in it. Sorry for that.

    Stefan



--

      ...ich hab' noch einen Koffer in Berlin...

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to