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;
13781378
13791379#endif
13801380
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.
13811388template <typename PM>
13821389using must_be_member_function_pointer
13831390 = detail::enable_if_t <std::is_member_pointer<PM>::value, int >;
13841391
1392+ // Note that xetter_cpp_function is intentionally in the main pybind11 namespace,
1393+ // because user-defined specializations could be useful.
1394+
13851395// Classic (non-smart_holder) implementations for .def_readonly and .def_readwrite
13861396// getter and setter functions.
13871397// 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