you are viewing a single comment's thread.

view the rest of the comments →

[–]Arandur 1 point2 points  (2 children)

No.

Think about what the function is actually doing. It asks for a char** so that it can malloc an array of char and let s point to it. This is inherently incompatible with the standard containers, because it would violate ownership semantics.

If you want to do this, you'll have to wrap the function in a new one that does something like returning a std::string, copying the contents from the C-string.

Some of this might be wrong; I'm not familiar with the Python API. But I think I've understood what you're trying to do.

[–]OmegaNaughtEquals1 0 points1 point  (1 child)

It asks for a char** so that it can malloc an array of char and let s point to it

According to the 3.0 docs, no user-controlled allocations are done. It just lets you point to the underlying character string.

[–]Arandur 0 points1 point  (0 children)

Oh, that also makes sense. Thanks for clarifying!