Add a scope guard call policy

```c++
m.def("foo", foo, py::call_guard<T>());
```

is equivalent to:

```c++
m.def("foo", [](args...) {
    T scope_guard;
    return foo(args...); // forwarded arguments
});
```
This commit is contained in:
Dean Moldovan
2017-03-16 11:22:26 +01:00
parent 83a8a977a7
commit 1ac19036d6
10 changed files with 217 additions and 59 deletions

View File

@@ -28,6 +28,7 @@ endif()
set(PYBIND11_TEST_FILES
test_alias_initialization.cpp
test_buffers.cpp
test_call_policies.cpp
test_callbacks.cpp
test_chrono.cpp
test_class_args.cpp
@@ -40,7 +41,6 @@ set(PYBIND11_TEST_FILES
test_exceptions.cpp
test_inheritance.cpp
test_issues.cpp
test_keep_alive.cpp
test_kwargs_and_defaults.cpp
test_methods_and_attributes.cpp
test_modules.cpp