Working type casters for wide strings and wide characters

This commit is contained in:
Wenzel Jakob
2016-03-08 19:40:32 +01:00
5 changed files with 66 additions and 20 deletions

View File

@@ -60,9 +60,9 @@ public:
}
/* C++ STL data types are automatically casted */
std::vector<std::string> get_list_2() {
std::vector<std::string> list;
list.push_back("value");
std::vector<std::wstring> get_list_2() {
std::vector<std::wstring> list;
list.push_back(L"value");
return list;
}
@@ -103,10 +103,10 @@ public:
}
/* STL data types (such as vectors) are automatically casted from Python */
void print_list_2(std::vector<std::string> &list) {
void print_list_2(std::vector<std::wstring> &list) {
int index = 0;
for (auto item : list)
std::cout << "list item " << index++ << ": " << item << std::endl;
std::wcout << L"list item " << index++ << L": " << item << std::endl;
}
/* pybind automatically translates between C++11 and Python tuples */