@@ -142,6 +142,151 @@ namespace ecm::math
142142 * \since v1.0.0
143143 */
144144 constexpr T const & operator [](const uint8 axis) const ;
145+
146+ // Unary arithmetic operators
147+
148+ /* *
149+ * Assignment operator.
150+ * Assigns the values of another vector to this one.
151+ *
152+ * \param v The vector to assign from.
153+ *
154+ * \returns A reference to this vector after assignment.
155+ *
156+ * \since v1.0.0
157+ */
158+ constexpr Vector4_Base<T>& operator =(Vector4_Base<T> const & v);
159+
160+ /* *
161+ * Assignment operator for a vector with different component type.
162+ * Assigns and casts the components from a vector of type U.
163+ *
164+ * \param v The vector to assign from.
165+ *
166+ * \tparam U The type of the source vector's component.
167+ *
168+ * \returns A reference to this vector after assignment.
169+ *
170+ * \since v1.0.0
171+ */
172+ template <typename U, typename = std::enable_if_t <std::is_arithmetic<U>::value>>
173+ constexpr Vector4_Base<T>& operator =(Vector4_Base<U> const & v);
174+
175+ /* *
176+ * Adds a scalar to each component of the vector.
177+ *
178+ * \param scalar The scalar value to add.
179+ *
180+ * \tparam U The type of the scalar, must be arithmetic.
181+ *
182+ * \returns A reference to this vector after addition.
183+ *
184+ * \since v1.0.0
185+ */
186+ template <typename U, typename = std::enable_if_t <std::is_arithmetic<U>::value>>
187+ constexpr Vector4_Base<T>& operator +=(U scalar);
188+
189+ /* *
190+ * Adds another vector to this one component-wise.
191+ *
192+ * \param v The vector to add.
193+ *
194+ * \tparam U The type of the other vector's components, must be
195+ * arithmetic.
196+ *
197+ * \returns A reference to this vector after addition.
198+ *
199+ * \since v1.0.0
200+ */
201+ template <typename U, typename = std::enable_if_t <std::is_arithmetic<U>::value>>
202+ constexpr Vector4_Base<T>& operator +=(Vector4_Base<U> const & v);
203+
204+ /* *
205+ * Subtracts a scalar from each component of the vector.
206+ *
207+ * \param scalar The scalar value to subtract.
208+ *
209+ * \tparam U The type of the scalar, must be arithmetic.
210+ *
211+ * \returns A reference to this vector after subtraction
212+ *
213+ * \since v1.0.0
214+ */
215+ template <typename U, typename = std::enable_if_t <std::is_arithmetic<U>::value>>
216+ constexpr Vector4_Base<T>& operator -=(U scalar);
217+
218+ /* *
219+ * Subtracts another vector from this one component-wise.
220+ *
221+ * \param v The vector to subtract.
222+ *
223+ * \tparam U The type of the other vector's components, must be
224+ * arithmetic.
225+ *
226+ * \returns A reference to this vector after subtraction.
227+ *
228+ * \since v1.0.0
229+ */
230+ template <typename U, typename = std::enable_if_t <std::is_arithmetic<U>::value>>
231+ constexpr Vector4_Base<T>& operator -=(Vector4_Base<U> const & v);
232+
233+ /* *
234+ * Multiplies each component of the vector by a scalar.
235+ *
236+ * \param scalar The scalar value to multiply by.
237+ *
238+ * \tparam U The type of the scalar, must be arithmetic.
239+ *
240+ * \returns A reference to this vector after multiplication.
241+ *
242+ * \since v1.0.0
243+ */
244+ template <typename U, typename = std::enable_if_t <std::is_arithmetic<U>::value>>
245+ constexpr Vector4_Base<T>& operator *=(U scalar);
246+
247+ /* *
248+ * Multiplies this vector component-wise by another vector.
249+ *
250+ * \param v The vector to multiply by.
251+ *
252+ * \tparam U The type of the other vector's components, must be
253+ * arithmetic.
254+ *
255+ * \returns A reference to this vector after multiplication.
256+ *
257+ * \since v1.0.0
258+ */
259+ template <typename U, typename = std::enable_if_t <std::is_arithmetic<U>::value>>
260+ constexpr Vector4_Base<T>& operator *=(Vector4_Base<U> const & v);
261+
262+ /* *
263+ * Divides each component of the vector by a scalar.
264+ *
265+ * \param scalar The scalar value to divide by.
266+ *
267+ * \tparam U The type of the scalar, must be arithmetic.
268+ *
269+ * \returns A reference to this vector after division.
270+ *
271+ * \since v1.0.0
272+ */
273+ template <typename U, typename = std::enable_if_t <std::is_arithmetic<U>::value>>
274+ constexpr Vector4_Base<T>& operator /=(U scalar);
275+
276+ /* *
277+ * Divides this vector component-wise by another vector.
278+ *
279+ * \param v The vector to divide by.
280+ *
281+ * \tparam U The type of the other vector's components, must be
282+ * arithmetic.
283+ *
284+ * \returns A reference to this vector after division.
285+ *
286+ * \since v1.0.0
287+ */
288+ template <typename U, typename = std::enable_if_t <std::is_arithmetic<U>::value>>
289+ constexpr Vector4_Base<T>& operator /=(Vector4_Base<U> const & v);
145290 };
146291
147292 /* *
@@ -305,70 +450,6 @@ namespace ecm::math
305450 template <typename _Ty> constexpr Vector4_Base<_Ty> operator /(
306451 const Vector4_Base<_Ty>& left, const Vector4_Base<_Ty>& right);
307452
308- /*
309- * This operator adds the two Vector4 objects left and right together and
310- * returns the new value of left.
311- *
312- * \param left Left Vector4 operand.
313- * \param right Right Vector4 operand.
314- *
315- * \returns After calculation reference to left.
316- *
317- * \since v1.0.0
318- *
319- * \sa Vector4
320- */
321- template <typename _Ty> constexpr Vector4_Base<_Ty>& operator +=(
322- Vector4_Base<_Ty>& left, const Vector4_Base<_Ty>& right);
323-
324- /*
325- * This operator subtracts the two Vector4 objects left and right together
326- * and returns the new value of left.
327- *
328- * \param left Left Vector4 operand.
329- * \param right Right Vector4 operand.
330- *
331- * \returns After calculation reference to left.
332- *
333- * \since v1.0.0
334- *
335- * \sa Vector4
336- */
337- template <typename _Ty> constexpr Vector4_Base<_Ty>& operator -=(
338- Vector4_Base<_Ty>& left, const Vector4_Base<_Ty>& right);
339-
340- /*
341- * This operator multiplies the two Vector4 objects left and right together
342- * and returns the new value of left.
343- *
344- * \param left Left Vector4 operand.
345- * \param right Right Vector4 operand.
346- *
347- * \returns After calculation reference to left.
348- *
349- * \since v1.0.0
350- *
351- * \sa Vector4
352- */
353- template <typename _Ty> constexpr Vector4_Base<_Ty>& operator *=(
354- Vector4_Base<_Ty>& left, const Vector4_Base<_Ty>& right);
355-
356- /*
357- * This operator devides the two Vector4 objects left and right together and
358- * returns the new value of left.
359- *
360- * \param left Left Vector4 operand.
361- * \param right Right Vector4 operand.
362- *
363- * \returns After calculation reference to left.
364- *
365- * \since v1.0.0
366- *
367- * \sa Vector4
368- */
369- template <typename _Ty> constexpr Vector4_Base<_Ty>& operator /=(
370- Vector4_Base<_Ty>& left, const Vector4_Base<_Ty>& right);
371-
372453 /*
373454 * This operator creates an new Vector4 object, calculates the addition of a
374455 * Vector4 object and a Float32 object, left and right component-wise and
@@ -437,70 +518,6 @@ namespace ecm::math
437518 */
438519 template <typename _Ty> constexpr Vector4_Base<_Ty> operator /(
439520 const Vector4_Base<_Ty>& left, const _Ty& right);
440-
441- /*
442- * This operator adds a Float32 object to a Vector4 object, left and right
443- * together and returns the new value of left.
444- *
445- * \param left Left Vector4 operand.
446- * \param right Right Float32 operand.
447- *
448- * \returns After calculation reference to left.
449- *
450- * \since v1.0.0
451- *
452- * \sa Vector4
453- */
454- template <typename _Ty> constexpr Vector4_Base<_Ty>& operator +=(
455- Vector4_Base<_Ty>& left, _Ty& right);
456-
457- /*
458- * This operator subtracts a Float32 object from a Vector4 object, left and
459- * right together and returns the new value of left.
460- *
461- * \param left Left Vector4 operand.
462- * \param right Right Float32 operand.
463- *
464- * \returns After calculation reference to left.
465- *
466- * \since v1.0.0
467- *
468- * \sa Vector4
469- */
470- template <typename _Ty> constexpr Vector4_Base<_Ty>& operator -=(
471- Vector4_Base<_Ty>& left, _Ty& right);
472-
473- /*
474- * This operator multiplies a Float32 object with a Vector4 object, left and
475- * right together and returns the new value of left.
476- *
477- * \param left Left Vector4 operand.
478- * \param right Right Float32 operand.
479- *
480- * \returns After calculation reference to left.
481- *
482- * \since v1.0.0
483- *
484- * \sa Vector4
485- */
486- template <typename _Ty> constexpr Vector4_Base<_Ty>& operator *=(
487- Vector4_Base<_Ty>& left, _Ty& right);
488-
489- /*
490- * This operator devides a Float32 object with a Vector4 object, left and
491- * right together and returns the new value of left.
492- *
493- * \param left Left Vector4 operand.
494- * \param right Right Float32 operand.
495- *
496- * \returns After calculation reference to left.
497- *
498- * \since v1.0.0
499- *
500- * \sa Vector4
501- */
502- template <typename _Ty> constexpr Vector4_Base<_Ty>& operator /=(
503- Vector4_Base<_Ty>& left, _Ty& right);
504521} // namespace ecm::math
505522
506523#include " vector4.inl"
0 commit comments