Dan Nuffer <[EMAIL PROTECTED]> writes:

> 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

Oh, I'm guessing that this is due to the odd status of const
char*. I'll look into it.

In the meantime, is it practical for you to use std::string instead of
const char*?

-- 
                       David Abrahams
   [EMAIL PROTECTED] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to