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));
49 if (in.value != expected) {
50 throw std::runtime_error(
"Value changed!!");
56 [](
int expected,
const IntStruct &in) {
57 std::this_thread::sleep_for(std::chrono::milliseconds(5));
58 if (in.value != expected) {
59 throw std::runtime_error(
"Value changed!!");
62 py::call_guard<py::gil_scoped_release>());
Array< int, Dynamic, 1 > v
TEST_SUBMODULE(thread, m)
detail::initimpl::constructor< Args... > init()
Binds an existing constructor taking arguments Args...