@@ -47,7 +47,7 @@ class PyExampleVirt : public ExampleVirt {
4747
4848 int run (int value) override {
4949 /* Generate wrapping code that enables native function overloading */
50- PYBIND11_OVERLOAD (
50+ PYBIND11_OVERRIDE (
5151 int , /* Return type */
5252 ExampleVirt, /* Parent class */
5353 run, /* Name of function */
@@ -56,7 +56,7 @@ class PyExampleVirt : public ExampleVirt {
5656 }
5757
5858 bool run_bool () override {
59- PYBIND11_OVERLOAD_PURE (
59+ PYBIND11_OVERRIDE_PURE (
6060 bool , /* Return type */
6161 ExampleVirt, /* Parent class */
6262 run_bool, /* Name of function */
@@ -66,7 +66,7 @@ class PyExampleVirt : public ExampleVirt {
6666 }
6767
6868 void pure_virtual () override {
69- PYBIND11_OVERLOAD_PURE (
69+ PYBIND11_OVERRIDE_PURE (
7070 void , /* Return type */
7171 ExampleVirt, /* Parent class */
7272 pure_virtual, /* Name of function */
@@ -78,7 +78,7 @@ class PyExampleVirt : public ExampleVirt {
7878 // We can return reference types for compatibility with C++ virtual interfaces that do so, but
7979 // note they have some significant limitations (see the documentation).
8080 const std::string &get_string1 () override {
81- PYBIND11_OVERLOAD (
81+ PYBIND11_OVERRIDE (
8282 const std::string &, /* Return type */
8383 ExampleVirt, /* Parent class */
8484 get_string1, /* Name of function */
@@ -87,7 +87,7 @@ class PyExampleVirt : public ExampleVirt {
8787 }
8888
8989 const std::string *get_string2 () override {
90- PYBIND11_OVERLOAD (
90+ PYBIND11_OVERRIDE (
9191 const std::string *, /* Return type */
9292 ExampleVirt, /* Parent class */
9393 get_string2, /* Name of function */
@@ -141,11 +141,11 @@ class NCVirt {
141141class NCVirtTrampoline : public NCVirt {
142142#if !defined(__INTEL_COMPILER)
143143 NonCopyable get_noncopyable (int a, int b) override {
144- PYBIND11_OVERLOAD (NonCopyable, NCVirt, get_noncopyable, a, b);
144+ PYBIND11_OVERRIDE (NonCopyable, NCVirt, get_noncopyable, a, b);
145145 }
146146#endif
147147 Movable get_movable (int a, int b) override {
148- PYBIND11_OVERLOAD_PURE (Movable, NCVirt, get_movable, a, b);
148+ PYBIND11_OVERRIDE_PURE (Movable, NCVirt, get_movable, a, b);
149149 }
150150};
151151
@@ -159,7 +159,7 @@ struct Base {
159159
160160struct DispatchIssue : Base {
161161 virtual std::string dispatch () const {
162- PYBIND11_OVERLOAD_PURE (std::string, Base, dispatch, /* no arguments */ );
162+ PYBIND11_OVERRIDE_PURE (std::string, Base, dispatch, /* no arguments */ );
163163 }
164164};
165165
@@ -240,7 +240,7 @@ TEST_SUBMODULE(virtual_functions, m) {
240240 py::print (" PyA.f()" );
241241 // This convolution just gives a `void`, but tests that PYBIND11_TYPE() works to protect
242242 // a type containing a ,
243- PYBIND11_OVERLOAD (PYBIND11_TYPE (typename std::enable_if<true , void >::type), A, f);
243+ PYBIND11_OVERRIDE (PYBIND11_TYPE (typename std::enable_if<true , void >::type), A, f);
244244 }
245245 };
246246
@@ -265,7 +265,7 @@ TEST_SUBMODULE(virtual_functions, m) {
265265 ~PyA2 () { py::print (" PyA2.~PyA2()" ); }
266266 void f () override {
267267 py::print (" PyA2.f()" );
268- PYBIND11_OVERLOAD (void , A2, f);
268+ PYBIND11_OVERRIDE (void , A2, f);
269269 }
270270 };
271271
@@ -304,19 +304,19 @@ TEST_SUBMODULE(virtual_functions, m) {
304304 class PyOverrideTest : public OverrideTest {
305305 public:
306306 using OverrideTest::OverrideTest;
307- std::string str_value () override { PYBIND11_OVERLOAD (std::string, OverrideTest, str_value); }
307+ std::string str_value () override { PYBIND11_OVERRIDE (std::string, OverrideTest, str_value); }
308308 // Not allowed (uncommenting should hit a static_assert failure): we can't get a reference
309309 // to a python numeric value, since we only copy values in the numeric type caster:
310- // std::string &str_ref() override { PYBIND11_OVERLOAD (std::string &, OverrideTest, str_ref); }
310+ // std::string &str_ref() override { PYBIND11_OVERRIDE (std::string &, OverrideTest, str_ref); }
311311 // But we can work around it like this:
312312 private:
313313 std::string _tmp;
314- std::string str_ref_helper () { PYBIND11_OVERLOAD (std::string, OverrideTest, str_ref); }
314+ std::string str_ref_helper () { PYBIND11_OVERRIDE (std::string, OverrideTest, str_ref); }
315315 public:
316316 std::string &str_ref () override { return _tmp = str_ref_helper (); }
317317
318- A A_value () override { PYBIND11_OVERLOAD (A, OverrideTest, A_value); }
319- A &A_ref () override { PYBIND11_OVERLOAD (A &, OverrideTest, A_ref); }
318+ A A_value () override { PYBIND11_OVERRIDE (A, OverrideTest, A_value); }
319+ A &A_ref () override { PYBIND11_OVERRIDE (A &, OverrideTest, A_ref); }
320320 };
321321
322322 py::class_<OverrideTest::A>(m, " OverrideTest_A" )
@@ -393,29 +393,29 @@ class D_Tpl : public C_Tpl { D_METHODS };
393393class PyA_Repeat : public A_Repeat {
394394public:
395395 using A_Repeat::A_Repeat;
396- int unlucky_number () override { PYBIND11_OVERLOAD_PURE (int , A_Repeat, unlucky_number, ); }
397- std::string say_something (unsigned times) override { PYBIND11_OVERLOAD (std::string, A_Repeat, say_something, times); }
396+ int unlucky_number () override { PYBIND11_OVERRIDE_PURE (int , A_Repeat, unlucky_number, ); }
397+ std::string say_something (unsigned times) override { PYBIND11_OVERRIDE (std::string, A_Repeat, say_something, times); }
398398};
399399class PyB_Repeat : public B_Repeat {
400400public:
401401 using B_Repeat::B_Repeat;
402- int unlucky_number () override { PYBIND11_OVERLOAD (int , B_Repeat, unlucky_number, ); }
403- std::string say_something (unsigned times) override { PYBIND11_OVERLOAD (std::string, B_Repeat, say_something, times); }
404- double lucky_number () override { PYBIND11_OVERLOAD (double , B_Repeat, lucky_number, ); }
402+ int unlucky_number () override { PYBIND11_OVERRIDE (int , B_Repeat, unlucky_number, ); }
403+ std::string say_something (unsigned times) override { PYBIND11_OVERRIDE (std::string, B_Repeat, say_something, times); }
404+ double lucky_number () override { PYBIND11_OVERRIDE (double , B_Repeat, lucky_number, ); }
405405};
406406class PyC_Repeat : public C_Repeat {
407407public:
408408 using C_Repeat::C_Repeat;
409- int unlucky_number () override { PYBIND11_OVERLOAD (int , C_Repeat, unlucky_number, ); }
410- std::string say_something (unsigned times) override { PYBIND11_OVERLOAD (std::string, C_Repeat, say_something, times); }
411- double lucky_number () override { PYBIND11_OVERLOAD (double , C_Repeat, lucky_number, ); }
409+ int unlucky_number () override { PYBIND11_OVERRIDE (int , C_Repeat, unlucky_number, ); }
410+ std::string say_something (unsigned times) override { PYBIND11_OVERRIDE (std::string, C_Repeat, say_something, times); }
411+ double lucky_number () override { PYBIND11_OVERRIDE (double , C_Repeat, lucky_number, ); }
412412};
413413class PyD_Repeat : public D_Repeat {
414414public:
415415 using D_Repeat::D_Repeat;
416- int unlucky_number () override { PYBIND11_OVERLOAD (int , D_Repeat, unlucky_number, ); }
417- std::string say_something (unsigned times) override { PYBIND11_OVERLOAD (std::string, D_Repeat, say_something, times); }
418- double lucky_number () override { PYBIND11_OVERLOAD (double , D_Repeat, lucky_number, ); }
416+ int unlucky_number () override { PYBIND11_OVERRIDE (int , D_Repeat, unlucky_number, ); }
417+ std::string say_something (unsigned times) override { PYBIND11_OVERRIDE (std::string, D_Repeat, say_something, times); }
418+ double lucky_number () override { PYBIND11_OVERRIDE (double , D_Repeat, lucky_number, ); }
419419};
420420
421421// Inheritance approach 2: templated trampoline classes.
@@ -436,15 +436,15 @@ template <class Base = A_Tpl>
436436class PyA_Tpl : public Base {
437437public:
438438 using Base::Base; // Inherit constructors
439- int unlucky_number () override { PYBIND11_OVERLOAD_PURE (int , Base, unlucky_number, ); }
440- std::string say_something (unsigned times) override { PYBIND11_OVERLOAD (std::string, Base, say_something, times); }
439+ int unlucky_number () override { PYBIND11_OVERRIDE_PURE (int , Base, unlucky_number, ); }
440+ std::string say_something (unsigned times) override { PYBIND11_OVERRIDE (std::string, Base, say_something, times); }
441441};
442442template <class Base = B_Tpl>
443443class PyB_Tpl : public PyA_Tpl <Base> {
444444public:
445445 using PyA_Tpl<Base>::PyA_Tpl; // Inherit constructors (via PyA_Tpl's inherited constructors)
446- int unlucky_number () override { PYBIND11_OVERLOAD (int , Base, unlucky_number, ); }
447- double lucky_number () override { PYBIND11_OVERLOAD (double , Base, lucky_number, ); }
446+ int unlucky_number () override { PYBIND11_OVERRIDE (int , Base, unlucky_number, ); }
447+ double lucky_number () override { PYBIND11_OVERRIDE (double , Base, lucky_number, ); }
448448};
449449// Since C_Tpl and D_Tpl don't declare any new virtual methods, we don't actually need these (we can
450450// use PyB_Tpl<C_Tpl> and PyB_Tpl<D_Tpl> for the trampoline classes instead):
0 commit comments