Boost logo

Boost :

From: limberm_at_[hidden]
Date: 2001-03-01 11:28:33


Hi All,
   Please forgive me if this has been discussed, but I couldn't find
mention of it.

   I have a C++ library I am wrapping that routinely passes
std::wstrings about.

   BPL didn't compile with just a naive wrapping. So, I changed
conversions.hpp/cpp to add the functions:

PyObject* to_python (const wchar_t* s);
PyObject* to_python (const std::wstring& s);

const wchar_t* from_python (PyObject*, boost::python::type<const
wchar_t*>);
std::wstring from_python (PyObject*,
boost::python::type<std::wstring>);
std::wstring from_python (PyObject*, boost::python::type<const
std::wstring&>);

Now it seems to work.

I suppose my alternative was to write wrapper functions that converted
from wstrings to strings, and just use these wrt boost, but I try to
avoid work whenever I can.

Are my above additions to conversions.* necessary? Or am I (most
likely) out to lunch?

Thanks,
mark


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk