Skip to content

Commit f1e1b41

Browse files
committed
Adding comments (no code changes).
1 parent 2e9423a commit f1e1b41

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/pybind11/pybind11.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff 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.
13811388
template <typename PM>
13821389
using 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.

0 commit comments

Comments
 (0)