Pointer argument to boost python
Posted
by piotr
on Stack Overflow
See other posts from Stack Overflow
or by piotr
Published on 2010-03-05T09:06:07Z
Indexed on
2010/03/27
23:53 UTC
Read the original article
Hit count: 541
What's the best way to make a function that has pointer as argument work with boost python? I see there are many possibilities for return values in the docs, but I don't know how to do it with arguments.
void Tesuto::testp(std::string* s)
{
if (!s)
cout << " NULL s" << endl;
else
cout << s << endl;
}
>>> t.testp(None)
NULL s
>>>
>>> s='test'
>>> t.testp(s)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
Boost.Python.ArgumentError: Python argument types in
Tesuto.testp(Tesuto, str)
did not match C++ signature:
testp(Tesuto {lvalue}, std::string*)
>>>
© Stack Overflow or respective owner