MCPcopy Create free account
hub / github.com/pybind/pybind11 / PYBIND11_OVERRIDE

Function PYBIND11_OVERRIDE

tests/test_factory_constructors.cpp:131–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129 }
130 ~PyTF6() override { print_destroyed(this); }
131 int get() override { PYBIND11_OVERRIDE(int, TestFactory6, get, /*no args*/); }
132};
133
134class TestFactory7 {
135protected:
136 int value;
137 bool alias = false;
138
139public:
140 explicit TestFactory7(int i) : value{i} { print_created(this, i); }
141 TestFactory7(TestFactory7 &&f) noexcept {
142 print_move_created(this);
143 // NOLINTNEXTLINE(cppcoreguidelines-prefer-member-initializer)
144 value = f.value;
145 // NOLINTNEXTLINE(cppcoreguidelines-prefer-member-initializer)
146 alias = f.alias;
147 }
148 TestFactory7(const TestFactory7 &f) {
149 print_copy_created(this);
150 // NOLINTNEXTLINE(cppcoreguidelines-prefer-member-initializer)
151 value = f.value;
152 // NOLINTNEXTLINE(cppcoreguidelines-prefer-member-initializer)
153 alias = f.alias;
154 }
155 virtual ~TestFactory7() { print_destroyed(this); }
156 virtual int get() { return value; }
157 bool has_alias() const { return alias; }
158};
159class PyTF7 : public TestFactory7 {
160public:
161 explicit PyTF7(int i) : TestFactory7(i) {
162 // NOLINTNEXTLINE(cppcoreguidelines-prefer-member-initializer)
163 alias = true;
164 print_created(this, i);
165 }
166 PyTF7(PyTF7 &&f) noexcept : TestFactory7(std::move(f)) { print_move_created(this); }
167 PyTF7(const PyTF7 &f) : TestFactory7(f) { print_copy_created(this); }
168 ~PyTF7() override { print_destroyed(this); }
169 int get() override { PYBIND11_OVERRIDE(int, TestFactory7, get, /*no args*/); }

Callers

nothing calls this directly

Calls 11

PyTF7Function · 0.85
TestFactory7Class · 0.85
print_createdFunction · 0.85
moveFunction · 0.85
print_move_createdFunction · 0.85
initFunction · 0.85
TestFactory6Class · 0.85
PyTF6Function · 0.85
NoisyAllocClass · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected