68 #pragma GCC diagnostic push 74 #if (__APPLE__) && (__clang__) 75 #if (__clang_major__ >= 10) && (__clang_minor__ >= 0) && (__clang_patchlevel__ >= 1) 76 #pragma GCC diagnostic ignored "-Wself-assign-overloaded" 79 #if (__clang_major__ >= 7) 80 #pragma GCC diagnostic ignored "-Wself-assign-overloaded" 89 .def(py::init<float, float>())
97 .
def(py::self / py::self)
98 .
def(py::self += py::self)
99 .
def(py::self -= py::self)
100 .
def(py::self *=
float())
101 .
def(py::self /=
float())
102 .
def(py::self *= py::self)
103 .
def(py::self /= py::self)
104 .
def(
float() + py::self)
105 .
def(
float() - py::self)
106 .
def(
float() * py::self)
107 .
def(
float() / py::self)
113 m.
attr(
"Vector") = m.
attr(
"Vector2");
119 .def(py::self + py::self);
123 .def(py::self + py::self)
124 .
def(
"__add__", [](
const C2& c2,
const C1& c1) {
return c2 + c1; })
125 .def(
"__radd__", [](
const C2& c2,
const C1& c1) {
return c1 + c2; });
129 struct NestABase {
int value = -2; };
134 struct NestA : NestABase {
140 .def(py::self +=
int())
141 .def(
"as_base", [](NestA &a) -> NestABase& {
142 return (NestABase&) a;
143 }, py::return_value_policy::reference_internal);
144 m.
def(
"get_NestA", [](
const NestA &a) {
return a.value; });
153 .def(py::self -=
int())
154 .def_readwrite(
"a", &NestB::a);
155 m.
def(
"get_NestB", [](
const NestB &b) {
return b.value; });
164 .def(py::self *=
int())
165 .def_readwrite(
"b", &NestC::b);
166 m.
def(
"get_NestC", [](
const NestC &c) {
return c.value; });
170 #pragma GCC diagnostic pop Vector2 operator/(float value) const
Vector2 operator+(const Vector2 &v) const
Vector2 & operator/=(const Vector2 &v)
friend Vector2 operator/(float f, const Vector2 &v)
Vector2 & operator+=(const Vector2 &v)
void print_destroyed(T *inst, Values &&...values)
Vector2 operator*(const Vector2 &v) const
void print_copy_assigned(T *inst, Values &&...values)
void print_copy_created(T *inst, Values &&...values)
Vector2 & operator/=(float v)
Vector2 & operator-=(const Vector2 &v)
obj_attr_accessor attr(handle key) const
Vector2(const Vector2 &v)
op_< op_hash, op_u, self_t, undefined_t > hash(const self_t &)
Vector2 operator-(const Vector2 &v) const
Vector2 operator-() const
void print_move_assigned(T *inst, Values &&...values)
Vector2 & operator=(const Vector2 &v)
Vector2 & operator*=(float v)
size_t operator()(const Vector2 &)
Vector2 operator-(float value) const
test_initializer operators("operators", test_submodule_operators)
Vector2 operator*(float value) const
Vector2 & operator=(Vector2 &&v)
void print_created(T *inst, Values &&...values)
Vector2 operator/(const Vector2 &v) const
Vector2 operator+(float value) const
Vector2(float x, float y)
friend Vector2 operator+(float f, const Vector2 &v)
friend Vector2 operator-(float f, const Vector2 &v)
Vector2 & operator*=(const Vector2 &v)
void print_move_created(T *inst, Values &&...values)
#define TEST_SUBMODULE(name, variable)
friend Vector2 operator*(float f, const Vector2 &v)
bool typename Extra class_ & def(const char *name_, Func &&f, const Extra &... extra)
std::string toString() const
auto to_string(T &&value) -> decltype(std::forward< T >(value))
Convert an object to a string (directly forward if this can become a string)