David Abrahams wrote:
Dan Nuffer <[EMAIL PROTECTED]> writes:
10. I added implicitly_convertible<const char*,OW_String>(); It
compiled fine, but it didn't work:
>>> import owclient
>>> s = owclient.OW_String("a")
>>> s.concat(owclient.OW_String("b"))
<owclient.OW_String object at 0x817267c>
>>> s.c_str()
'ab'
>>> s.concat("c")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: bad argument type for built-in operation
Any ideas why this didn't work?
Not offhand. Can you post a small test case?
#include <boost/python.hpp>
using namespace boost::python;
struct test
{
test() {}
test(const char*) {}
void foo(const test&) {}
};
BOOST_PYTHON_MODULE(test)
{
class_<test>("test")
.def(init<const char*>())
.def("foo", &test::foo)
;
implicitly_convertible<const char*,test>();
}
>>> import test
>>> t = test.test("foo")
>>> t.foo("fooagain")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: bad argument type for built-in operation
HTH,
Dan Nuffer
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost