]> granicus.if.org Git - icinga2/commitdiff
Use 'default' for move constructors
authorGunnar Beutner <gunnar.beutner@netways.de>
Sat, 27 Aug 2016 09:39:08 +0000 (11:39 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Sat, 27 Aug 2016 09:39:08 +0000 (11:39 +0200)
refs #12555

lib/base/array.cpp
lib/base/string.hpp
lib/base/value-operators.cpp
lib/base/value.hpp

index 581284aa9d18aebc7ee621a29adcfa4ca9069fe1..916b49795cf67a03dca1b198c940e2aabed62215 100644 (file)
@@ -90,7 +90,7 @@ void Array::Add(Value&& value)
 {
        ObjectLock olock(this);
 
-       m_Data.push_back(value);
+       m_Data.push_back(std::move(value));
 }
 
 /**
index 38d94974c6cb75b9af7e1d266d534f6631297c22..159fbdc1b5cf2cfc3a459a682669080afe1525f3 100644 (file)
@@ -77,13 +77,8 @@ public:
                : m_Data(n, c)
        { }
 
-       inline String(const String& other)
-               : m_Data(other.m_Data)
-       { }
-
-       inline String(String&& other)
-               : m_Data(other)
-       { }
+       String(const String& other) = default;
+       String(String&& other) = default;
 
        inline ~String(void)
        { }
@@ -93,11 +88,8 @@ public:
                : m_Data(begin, end)
        { }
 
-       inline String& operator=(const String& rhs)
-       {
-               m_Data = rhs.m_Data;
-               return *this;
-       }
+       String& operator=(const String& rhs) = default;
+       String& operator=(String&& rhs) = default;
 
        inline String& operator=(const std::string& rhs)
        {
index 432b1603c0d2896ff1a36228dd154f93c58b7945..7adcbe207018d33ba14f72f28e640218abe4cd9a 100644 (file)
@@ -94,12 +94,6 @@ std::istream& icinga::operator>>(std::istream& stream, Value& value)
        return stream;
 }
 
-Value& Value::operator=(const Value& other)
-{
-       m_Value = other.m_Value;
-       return *this;
-}
-
 bool Value::operator==(bool rhs) const
 {
        return *this == Value(rhs);
index 1d265a5af2845e14c05cef064c13e7786aaa3f14..68a2250cd7b6725cfbdeab05e286bca627f654af 100644 (file)
@@ -99,13 +99,8 @@ public:
                : m_Value(String(value))
        { }
 
-       inline Value(const Value& other)
-               : m_Value(other.m_Value)
-       { }
-
-       inline Value(Value&& other)
-               : m_Value(other.m_Value)
-       { }
+       Value(const Value& other) = default;
+       Value(Value&& other) = default;
 
        inline Value(Object *value)
        {
@@ -129,7 +124,8 @@ public:
        operator double(void) const;
        operator String(void) const;
 
-       Value& operator=(const Value& other);
+       Value& operator=(const Value& other) = default;
+       Value& operator=(Value&& other) = default;
 
        bool operator==(bool rhs) const;
        bool operator!=(bool rhs) const;