File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -1378,10 +1378,20 @@ using default_holder_type = smart_holder;
1378
1378
1379
1379
#endif
1380
1380
1381
+ // Helper for the xetter_cpp_function static member functions below. xetter_cpp_function is
1382
+ // a shortcut for 'getter & setter adapters for .def_readonly & .def_readwrite'.
1383
+ // The only purpose of these adapters is to support .def_readonly & .def_readwrite.
1384
+ // In this context, the PM template parameter is certain to be a Pointer to a Member.
1385
+ // The main purpose of must_be_member_function_pointer is to make this obvious, and to guard
1386
+ // against accidents. As a side-effect, it also explains why the syntactical clutter for
1387
+ // perfect forwarding is not needed.
1381
1388
template <typename PM>
1382
1389
using must_be_member_function_pointer
1383
1390
= detail::enable_if_t <std::is_member_pointer<PM>::value, int >;
1384
1391
1392
+ // Note that xetter_cpp_function is intentionally in the main pybind11 namespace,
1393
+ // because user-defined specializations could be useful.
1394
+
1385
1395
// Classic (non-smart_holder) implementations for .def_readonly and .def_readwrite
1386
1396
// getter and setter functions.
1387
1397
// WARNING: This classic implementation can lead to dangling pointers for raw pointer members.
You can’t perform that action at this time.
0 commit comments