fix: use OVERRIDE instead of OVERLOAD (#2490)

* fix: use OVERRIDE instead of OVERLOAD

* docs: more accurate statement
This commit is contained in:
Henry Schreiner 2020-09-15 12:10:31 -04:00 committed by GitHub
parent 16f199f8d9
commit dabbbf315d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -196,9 +196,9 @@ Please take a look at the :ref:`macro_notes` before using this feature.
The :c:macro:`PYBIND11_OVERRIDE` and accompanying macros used to be called The :c:macro:`PYBIND11_OVERRIDE` and accompanying macros used to be called
``PYBIND11_OVERLOAD`` up until pybind11 v2.5.0, and :func:`get_override` ``PYBIND11_OVERLOAD`` up until pybind11 v2.5.0, and :func:`get_override`
used to be called ``get_overload``. This naming was corrected and the older used to be called ``get_overload``. This naming was corrected and the older
macro and function names have been deprecated, in order to reduce confusion macro and function names may soon be deprecated, in order to reduce
with overloaded functions and methods and ``py::overload_cast`` (see confusion with overloaded functions and methods and ``py::overload_cast``
:ref:`classes`). (see :ref:`classes`).
.. seealso:: .. seealso::

View File

@ -89,7 +89,7 @@ public:
PyTF6(const PyTF6 &f) : TestFactory6(f) { print_copy_created(this); } PyTF6(const PyTF6 &f) : TestFactory6(f) { print_copy_created(this); }
PyTF6(std::string s) : TestFactory6((int) s.size()) { alias = true; print_created(this, s); } PyTF6(std::string s) : TestFactory6((int) s.size()) { alias = true; print_created(this, s); }
~PyTF6() override { print_destroyed(this); } ~PyTF6() override { print_destroyed(this); }
int get() override { PYBIND11_OVERLOAD(int, TestFactory6, get, /*no args*/); } int get() override { PYBIND11_OVERRIDE(int, TestFactory6, get, /*no args*/); }
}; };
class TestFactory7 { class TestFactory7 {
@ -110,6 +110,7 @@ public:
PyTF7(PyTF7 &&f) : TestFactory7(std::move(f)) { print_move_created(this); } PyTF7(PyTF7 &&f) : TestFactory7(std::move(f)) { print_move_created(this); }
PyTF7(const PyTF7 &f) : TestFactory7(f) { print_copy_created(this); } PyTF7(const PyTF7 &f) : TestFactory7(f) { print_copy_created(this); }
~PyTF7() override { print_destroyed(this); } ~PyTF7() override { print_destroyed(this); }
int get() override { PYBIND11_OVERRIDE(int, TestFactory7, get, /*no args*/); }
}; };

View File

@ -159,7 +159,7 @@ struct Base {
struct DispatchIssue : Base { struct DispatchIssue : Base {
std::string dispatch() const override { std::string dispatch() const override {
PYBIND11_OVERLOAD_PURE(std::string, Base, dispatch, /* no arguments */); PYBIND11_OVERRIDE_PURE(std::string, Base, dispatch, /* no arguments */);
} }
}; };