23 explicit IntStruct(
int v) :
value(
v) {};
25 IntStruct(
const IntStruct &) =
default;
26 IntStruct &operator=(
const IntStruct &) =
default;
35 py::class_<IntStruct>(
m,
"IntStruct").def(
py::init([](
const int i) {
return IntStruct(
i); }));
41 py::implicitly_convertible<int, IntStruct>();
43 m.def(
"test", [](
int expected,
const IntStruct &in) {
46 std::this_thread::sleep_for(std::chrono::milliseconds(5));
50 throw std::runtime_error(
"Value changed!!");
56 [](
int expected,
const IntStruct &in) {
57 std::this_thread::sleep_for(std::chrono::milliseconds(5));
59 throw std::runtime_error(
"Value changed!!");
62 py::call_guard<py::gil_scoped_release>());