added new type pybind11::bytes, cleanup of various macros (fixes #49)

This commit is contained in:
Wenzel Jakob
2016-01-17 22:36:37 +01:00
parent 2dfbadee5d
commit 27e8e1066b
11 changed files with 135 additions and 103 deletions

View File

@@ -72,24 +72,12 @@ public:
std::cout << "key: " << item.first << ", value=" << item.second << std::endl;
}
/* STL data types are automatically casted from Python */
void print_dict_2(const std::map<std::string, std::string> &dict) {
for (auto item : dict)
std::cout << "key: " << item.first << ", value=" << item.second << std::endl;
}
/* Easily iterate over a setionary using a C++11 range-based for loop */
/* Easily iterate over a set using a C++11 range-based for loop */
void print_set(py::set set) {
for (auto item : set)
std::cout << "key: " << item << std::endl;
}
/* STL data types are automatically casted from Python */
void print_set_2(const std::set<std::string> &set) {
for (auto item : set)
std::cout << "key: " << item << std::endl;
}
/* Easily iterate over a list using a C++11 range-based for loop */
void print_list(py::list list) {
int index = 0;
@@ -97,7 +85,19 @@ public:
std::cout << "list item " << index++ << ": " << item << std::endl;
}
/* STL data types are automatically casted from Python */
/* STL data types (such as maps) are automatically casted from Python */
void print_dict_2(const std::map<std::string, std::string> &dict) {
for (auto item : dict)
std::cout << "key: " << item.first << ", value=" << item.second << std::endl;
}
/* STL data types (such as sets) are automatically casted from Python */
void print_set_2(const std::set<std::string> &set) {
for (auto item : set)
std::cout << "key: " << item << std::endl;
}
/* STL data types (such as vectors) are automatically casted from Python */
void print_list_2(std::vector<std::string> &list) {
int index = 0;
for (auto item : list)