[C++-sig] operator+(A, B) without B::B() default constructor in boost.python

2009-05-14 Thread Hans Roessler

Hello,
how can I wrap the following overloaded operator+ using boost.python?
The code as is fails with 
>...
>pytest.cpp: In function ‘void init_module_pytest()’:
>pytest.cpp:19: error: expected primary-expression before ‘(’ token
>...
If I try ".def(self+B())" instead of ".def(self+other())", the error is
>...
>pytest.cpp: In function ‘void init_module_pytest()’:
>pytest.cpp:17: error: no matching function for call to ‘B::B()’
>...

best wishes
Hans


pytest.cpp:

#include 
using namespace boost::python;

class A{
public:
};
class B{
public:
  B(int i){};
};

int operator+(const A& a,const B& b){return 42;};

BOOST_PYTHON_MODULE(pytest)
{
  class_("A")
.def(self+other())   //.def(self+B())//line 17
;
  class_("B",init)//line 19
;
}


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

[C++-sig] Question regarding importing libraries to weave

2009-05-14 Thread Magnús Bergur Magnússon
Hello,

My name is Magnus and I am working as a software developer for a company in
Iceland. We use weave inline with python to boost our processing capacity.
However there is one factor that is limiting us. We cannot figure out how to
import libraries to Weave such as just  or , what is the
right procedure for that? Also, what is the most effective tool for text
processing in python? We have been using weave inline and moving char by
char but is there a more effective way and could string.h speed things up?

Regards, Magnus Magnusson
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig