Jason Rhinelander
60526d4636
Support take_ownership for custom type casters given a pointer
...
This changes the pointer `cast()` in `PYBIND11_TYPE_CASTER` to recognize
the `take_ownership` policy: if casting a pointer with take-ownership,
the `cast()` now recalls `cast()` with a dereferenced rvalue (rather
than the previous code, which was always calling it with a const lvalue
reference), and deletes the pointer after the chained `cast()` is
complete.
This makes code like:
m.def("f", []() { return new std::vector<int>(100, 1); },
py::return_value_policy::take_ownership);
do the expected thing by taking over ownership of the returned pointer
(which is deleted once the chained cast completes).
2017-07-16 11:04:43 -04:00
..
2017-06-27 10:38:41 +02:00
2017-06-24 21:59:55 +02:00
2017-06-27 10:38:41 +02:00
2017-03-10 15:42:42 +01:00
2017-06-12 09:56:55 -03:00
2017-01-31 17:05:44 +01:00
2017-06-27 10:38:41 +02:00
2017-07-05 12:27:14 -04:00
2017-06-10 16:44:21 +02:00
2017-05-29 03:13:55 +02:00
2017-05-29 02:03:58 +02:00
2017-07-05 12:27:14 -04:00
2017-07-05 12:27:14 -04:00
2017-06-24 12:59:46 -04:00
2017-06-24 12:59:46 -04:00
2017-06-27 10:38:41 +02:00
2017-04-29 10:43:17 -04:00
2017-03-11 23:04:16 -04:00
2017-03-11 23:04:16 -04:00
2017-06-29 11:31:54 +02:00
2017-06-29 11:31:54 +02:00
2016-12-14 20:40:49 +01:00
2016-12-14 20:40:49 +01:00
2017-06-27 10:38:41 +02:00
2017-07-12 11:50:40 -04:00
2017-03-08 12:32:42 -05:00
2017-03-08 12:32:42 -05:00
2017-06-29 11:31:54 +02:00
2017-06-29 11:31:54 +02:00
2017-04-29 16:35:28 +02:00
2017-04-29 16:35:28 +02:00
2016-11-20 21:21:54 +01:00
2017-05-08 20:46:16 +02:00
2016-08-19 16:31:48 +02:00
2017-06-27 10:38:41 +02:00
2017-06-27 10:38:41 +02:00
2017-01-31 17:24:41 +01:00
2017-03-10 15:42:42 +01:00
2017-07-16 11:04:43 -04:00
2017-07-16 11:04:43 -04:00
2017-06-27 10:38:41 +02:00
2017-06-27 10:38:41 +02:00
2017-06-12 09:56:55 -03:00
2017-06-12 09:56:55 -03:00
2017-05-08 01:50:21 +02:00
2017-05-08 01:50:21 +02:00
2017-05-10 11:36:24 +02:00
2017-05-10 11:36:24 +02:00
2017-05-24 20:43:41 -04:00
2017-05-24 20:43:41 -04:00
2016-09-03 17:34:41 -04:00
2017-02-03 20:47:17 -05:00
2017-06-27 10:38:41 +02:00
2017-06-27 10:38:41 +02:00
2017-01-04 15:05:20 +01:00
2016-12-16 15:00:46 +01:00
2017-06-27 10:38:41 +02:00
2017-06-27 10:38:41 +02:00
2017-06-27 10:38:41 +02:00
2017-06-27 10:38:41 +02:00
2017-06-27 10:38:41 +02:00
2017-06-27 10:38:41 +02:00
2017-07-05 12:27:14 -04:00
2017-05-25 10:51:28 -04:00
2017-07-16 11:04:43 -04:00
2017-07-16 11:04:43 -04:00
2017-06-27 10:38:41 +02:00
2017-06-27 10:38:41 +02:00