From 91bbe2f2e59b1586db12bc6fd94b88155c448d48 Mon Sep 17 00:00:00 2001 From: eirrgang Date: Tue, 6 Jun 2017 11:57:17 -0400 Subject: [PATCH] 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. --- include/pybind11/pytypes.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/pybind11/pytypes.h b/include/pybind11/pytypes.h index e0ee4bc1..c8a5014e 100644 --- a/include/pybind11/pytypes.h +++ b/include/pybind11/pytypes.h @@ -388,6 +388,8 @@ class accessor : public object_api> { 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).