mirror of
https://github.com/pybind/pybind11.git
synced 2025-01-31 15:20:34 +00:00
Compatibility with old compilers.
This commit is contained in:
parent
a8144d971d
commit
1bf2577e1f
@ -3,7 +3,8 @@
|
||||
namespace mrc_ns { // minimal real caster
|
||||
|
||||
struct type_mrc {
|
||||
int value = -9999;
|
||||
explicit type_mrc(int v = -9999) : value(v) {}
|
||||
int value;
|
||||
};
|
||||
|
||||
struct minimal_real_caster {
|
||||
@ -42,6 +43,6 @@ struct type_caster<mrc_ns::type_mrc> : mrc_ns::minimal_real_caster {};
|
||||
} // namespace pybind11
|
||||
|
||||
TEST_SUBMODULE(odr_guard_1, m) {
|
||||
m.def("type_mrc_to_python", []() { return mrc_ns::type_mrc{101}; });
|
||||
m.def("type_mrc_to_python", []() { return mrc_ns::type_mrc(101); });
|
||||
m.def("type_mrc_from_python", [](const mrc_ns::type_mrc &obj) { return obj.value + 100; });
|
||||
}
|
||||
|
@ -3,7 +3,8 @@
|
||||
namespace mrc_ns { // minimal real caster
|
||||
|
||||
struct type_mrc {
|
||||
int value = -9999;
|
||||
explicit type_mrc(int v = -9999) : value(v) {}
|
||||
int value;
|
||||
};
|
||||
|
||||
struct minimal_real_caster {
|
||||
@ -42,6 +43,6 @@ struct type_caster<mrc_ns::type_mrc> : mrc_ns::minimal_real_caster {};
|
||||
} // namespace pybind11
|
||||
|
||||
TEST_SUBMODULE(odr_guard_2, m) {
|
||||
m.def("type_mrc_to_python", []() { return mrc_ns::type_mrc{202}; });
|
||||
m.def("type_mrc_to_python", []() { return mrc_ns::type_mrc(202); });
|
||||
m.def("type_mrc_from_python", [](const mrc_ns::type_mrc &obj) { return obj.value + 200; });
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user