]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
various: add explicit default contructors
authorAntoine Fontaine <antoine.fontaine@epfl.ch>
Sun, 21 Mar 2021 02:51:21 +0000 (03:51 +0100)
committerAntoine Fontaine <antoine.fontaine@epfl.ch>
Tue, 23 Mar 2021 12:34:41 +0000 (13:34 +0100)
libs/eclasslib.h
libs/splines/math_angles.h
libs/splines/math_quaternion.h
libs/splines/math_vector.h
libs/string/string.h
radiant/brush.h

index a733676a81d4faa559c59e6c1f5e0f08a4b2ce9f..15574450f8786980962336d44768976ce6fedabc 100644 (file)
@@ -78,8 +78,10 @@ class EntityClassAttribute
                CopiedString m_description;
                EntityClassAttribute(){
                }
+               EntityClassAttribute(const EntityClassAttribute& attr) = default;
                EntityClassAttribute( const char* type, const char* name, const char* value = "", const char* description = "" ) : m_type( type ), m_name( name ), m_value( value ), m_description( description ){
                }
+               EntityClassAttribute& operator=(const EntityClassAttribute& attr) = default;
 };
 
 typedef std::pair<CopiedString, EntityClassAttribute> EntityClassAttributePair;
index ee1d1f82bb9d90ebe2167d97862bd9bf2071fca2..e1916ca74d47ee0f5c1da51543e0f48a37d971d7 100644 (file)
@@ -53,8 +53,8 @@ public:
 
        void            set( float pitch, float yaw, float roll );
 
-       void operator=( angles_t const &a );
-       void operator=( idVec3 const &a );
+       angles_t &operator=( angles_t const &a ) = default;
+       angles_t &operator=( idVec3 const &a );
 
        friend angles_t operator+( const angles_t &a, const angles_t &b );
        angles_t        &operator+=( angles_t const &a );
@@ -68,7 +68,6 @@ public:
        angles_t        &operator*=( float a );
 
        friend int operator==( angles_t &a, angles_t &b );
-
        friend int operator!=( angles_t &a, angles_t &b );
 
        void            toVectors( idVec3 *forward, idVec3 *right = NULL, idVec3 *up = NULL );
@@ -116,16 +115,11 @@ inline void angles_t::set( float pitch, float yaw, float roll ) {
        this->roll  = roll;
 }
 
-inline void angles_t::operator=( angles_t const &a ) {
-       pitch   = a.pitch;
-       yaw     = a.yaw;
-       roll    = a.roll;
-}
-
-inline void angles_t::operator=( idVec3 const &a ) {
+inline angles_t &angles_t::operator=( idVec3 const &a ) {
        pitch   = a[ 0 ];
        yaw     = a[ 1 ];
        roll    = a[ 2 ];
+       return *this;
 }
 
 inline angles_t operator+( const angles_t &a, const angles_t &b ) {
index d428afbd5f8d1b5423cd52a84ede1d8f2489af40..e8341c04c1924cb299361b269ab44e7de4acc798 100644 (file)
@@ -38,6 +38,7 @@ public:
 
        quat_t();
        quat_t( float x, float y, float z, float w );
+       quat_t( const quat_t & ) = default;
 
        friend void toQuat( idVec3_t &src, quat_t &dst );
        friend void toQuat( angles_t &src, quat_t &dst );
@@ -50,7 +51,7 @@ public:
 
        void set( float x, float y, float z, float w );
 
-       void operator=( quat_t a );
+       quat_t &operator=( const quat_t &a ) = default;
 
        friend quat_t operator+( quat_t a, quat_t b );
        quat_t &operator+=( quat_t a );
@@ -102,13 +103,6 @@ inline void quat_t::set( float x, float y, float z, float w ) {
        this->w = w;
 }
 
-inline void quat_t::operator=( quat_t a ) {
-       x = a.x;
-       y = a.y;
-       z = a.z;
-       w = a.w;
-}
-
 inline quat_t operator+( quat_t a, quat_t b ) {
        return quat_t( a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w );
 }
index 3e6372e5db44335c231af4a403258b02e69ccfec..328ca3fea610835d3f37eeca58c27658ef0cf098 100644 (file)
@@ -135,6 +135,7 @@ public:
        idVec3() {dist = 0.0f; };
 #endif
        idVec3( const float x, const float y, const float z );
+       idVec3( const idVec3& ) = default;
 
        operator float *();
 
@@ -145,7 +146,7 @@ public:
 
        idVec3 operator-() const;
 
-       idVec3 &operator=( const idVec3 &a );
+       idVec3 &operator=( const idVec3 &a ) = default;
 
        float operator*( const idVec3 &a ) const;
        idVec3 operator*( const float a ) const;
@@ -206,14 +207,6 @@ ID_INLINE idVec3 idVec3::operator-() const {
        return idVec3( -x, -y, -z );
 }
 
-ID_INLINE idVec3 &idVec3::operator=( const idVec3 &a ) {
-       x = a.x;
-       y = a.y;
-       z = a.z;
-
-       return *this;
-}
-
 ID_INLINE void idVec3::set( const float x, const float y, const float z ) {
        this->x = x;
        this->y = y;
index 72423b57b03e97692bdb5fc97f2e8dfe3f4de9ae..5d63925d2c6ce14764bfa33ccfeb06eb5025665b 100644 (file)
@@ -328,6 +328,8 @@ public:
                : Buffer( range ){
        }
 
+       String(const String&) = default;
+
        String& operator=( const String& other ){
                String temp( other );
                temp.swap( *this );
index 9b91386c1e085b0c0ceae2785769d12df7ab9e20..01a61fec2c7904730565b6c8257675b442d3d1cf 100644 (file)
@@ -654,6 +654,8 @@ public:
                return FacePlane::m_type == eBrushTypeDoom3 || FacePlane::m_type == eBrushTypeQuake4;
        }
 
+       FacePlane& operator=(const FacePlane&) = default;
+
        class SavedState
        {
        public: