Skip to content

Commit a2d64d4

Browse files
committed
pybind.cpp
1 parent ec518b7 commit a2d64d4

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

section4/pybind.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,12 @@ PYBIND11_MODULE(pydemo, m)
4747
m.def("info",
4848
[]()
4949
{
50-
cout << "c++ version = " << __cplusplus << endl;
51-
cout << "gcc version = " << __VERSION__ << endl;
52-
cout << "libstdc++ = " << __GLIBCXX__ << endl;
50+
//cout << "c++ version = " << __cplusplus << endl;
51+
//cout << "gcc version = " << __VERSION__ << endl;
52+
//cout << "libstdc++ = " << __GLIBCXX__ << endl;
53+
py::print("c++ version =", __cplusplus);
54+
py::print("gcc version =", __VERSION__);
55+
py::print("libstdc++ =", __GLIBCXX__);
5356
}
5457
);
5558

@@ -63,7 +66,8 @@ PYBIND11_MODULE(pydemo, m)
6366
m.def("use_str",
6467
[](const string& str)
6568
{
66-
cout << str << endl;
69+
//cout << str << endl;
70+
py::print(str);
6771
return str + "!!";
6872
}
6973
);
@@ -84,10 +88,11 @@ PYBIND11_MODULE(pydemo, m)
8488
{
8589
auto vv = v;
8690

87-
for(auto& x : vv) {
88-
cout << x << ",";
89-
}
90-
cout << endl;
91+
//for(auto& x : vv) {
92+
// //cout << x << ",";
93+
//}
94+
//cout << endl;
95+
py::print("input :", vv);
9196

9297
vv.push_back(100);
9398

0 commit comments

Comments
 (0)