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

Class TestFactory3

tests/test_factory_constructors.cpp:54–72  ·  view source on GitHub ↗

Mixed direct/factory construction:

Source from the content-addressed store, hash-verified

52};
53// Mixed direct/factory construction:
54class TestFactory3 {
55protected:
56 friend class TestFactoryHelper;
57 TestFactory3() : value("(empty3)") { print_default_created(this); }
58 explicit TestFactory3(int v) : value(std::to_string(v)) { print_created(this, value); }
59
60public:
61 explicit TestFactory3(std::string v) : value(std::move(v)) { print_created(this, value); }
62 TestFactory3(TestFactory3 &&m) noexcept : value{std::move(m.value)} {
63 print_move_created(this);
64 }
65 TestFactory3 &operator=(TestFactory3 &&m) noexcept {
66 value = std::move(m.value);
67 print_move_assigned(this);
68 return *this;
69 }
70 std::string value;
71 virtual ~TestFactory3() { print_destroyed(this); }
72};
73// Inheritance test
74class TestFactory4 : public TestFactory3 {
75public:

Callers

nothing calls this directly

Calls 2

moveFunction · 0.85
print_move_assignedFunction · 0.85

Tested by

no test coverage detected