What is the best way to make a function that has a pointer as an argument work with boost python? I see that there are many possibilities for return values in documents, but I don’t know how to do this 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*) >>>
, , . Python . , , , python , , - , , , .
: :
std::string * pointer (std::string& p) { return &p; }
:
>>> s = 'hello' >>> t.testp (pointer (s)) hello >>>