mirror of
https://github.com/pybind/pybind11.git
synced 2025-01-18 17:05:53 +00:00
Explicitly define copy/move constructors for accessor
`accessor` currently relies on an implicit default copy constructor, but that is deprecated in C++11 when a copy assignment operator is present and can, in some cases, raise deprecation warnings (see #888). This commit explicitly specifies the default copy constructor and also adds a default move constructor.
This commit is contained in:
parent
8f6c129689
commit
91bbe2f2e5
@ -388,6 +388,8 @@ class accessor : public object_api<accessor<Policy>> {
|
||||
|
||||
public:
|
||||
accessor(handle obj, key_type key) : obj(obj), key(std::move(key)) { }
|
||||
accessor(const accessor &a) = default;
|
||||
accessor(accessor &&a) = default;
|
||||
|
||||
// accessor overload required to override default assignment operator (templates are not allowed
|
||||
// to replace default compiler-generated assignments).
|
||||
|
Loading…
Reference in New Issue
Block a user