Lines Matching defs:operator

2     tests/test_operator_overloading.cpp -- operator overloading
20 Vector2 &operator=(const Vector2 &v) { x = v.x; y = v.y; print_copy_assigned(this); return *this; }
21 Vector2 &operator=(Vector2 &&v) { x = v.x; y = v.y; v.x = v.y = 0; print_move_assigned(this); return *this; }
26 Vector2 operator-() const { return Vector2(-x, -y); }
27 Vector2 operator+(const Vector2 &v) const { return Vector2(x + v.x, y + v.y); }
28 Vector2 operator-(const Vector2 &v) const { return Vector2(x - v.x, y - v.y); }
29 Vector2 operator-(float value) const { return Vector2(x - value, y - value); }
30 Vector2 operator+(float value) const { return Vector2(x + value, y + value); }
31 Vector2 operator*(float value) const { return Vector2(x * value, y * value); }
32 Vector2 operator/(float value) const { return Vector2(x / value, y / value); }
33 Vector2 operator*(const Vector2 &v) const { return Vector2(x * v.x, y * v.y); }
34 Vector2 operator/(const Vector2 &v) const { return Vector2(x / v.x, y / v.y); }
35 Vector2& operator+=(const Vector2 &v) { x += v.x; y += v.y; return *this; }
36 Vector2& operator-=(const Vector2 &v) { x -= v.x; y -= v.y; return *this; }
37 Vector2& operator*=(float v) { x *= v; y *= v; return *this; }
38 Vector2& operator/=(float v) { x /= v; y /= v; return *this; }
39 Vector2& operator*=(const Vector2 &v) { x *= v.x; y *= v.y; return *this; }
40 Vector2& operator/=(const Vector2 &v) { x /= v.x; y /= v.y; return *this; }
42 friend Vector2 operator+(float f, const Vector2 &v) { return Vector2(f + v.x, f + v.y); }
43 friend Vector2 operator-(float f, const Vector2 &v) { return Vector2(f - v.x, f - v.y); }
44 friend Vector2 operator*(float f, const Vector2 &v) { return Vector2(f * v.x, f * v.y); }
45 friend Vector2 operator/(float f, const Vector2 &v) { return Vector2(f / v.x, f / v.y); }
53 int operator+(const C1 &, const C1 &) { return 11; }
54 int operator+(const C2 &, const C2 &) { return 22; }
55 int operator+(const C2 &, const C1 &) { return 21; }
56 int operator+(const C1 &, const C2 &) { return 12; }
62 size_t operator()(const Vector2 &) { return 4; }
116 // #393: need to return NotSupported to ensure correct arithmetic operator behavior
136 NestA& operator+=(int i) { value += i; return *this; }
149 NestB& operator-=(int i) { value -= i; return *this; }
160 NestC& operator*=(int i) { value *= i; return *this; }