Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 26, 2016, 8:32:16 PM (8 years ago)
Author:
muemart
Message:

Minor C++11 improvements:

  • Drop ImplicitConversion.h in favor of std::is_convertible.
  • Move constructor & assignment for MultiType and SubString. I'm not sure if the MultiType should convert types when moving. Currently it doesn't, because otherwise it would have no benefit over copying.
  • Use standard library functions for sleeping.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/util/MultiType.h

    r11071 r11098  
    100100#include <cassert>
    101101#include <string>
     102#include <utility>
    102103#include <OgreVector2.h>
    103104#include <OgreVector3.h>
     
    310311            /// Copyconstructor: Assigns value and type of the other MultiType.
    311312            inline MultiType(const MultiType& other) : value_(nullptr) { this->set(other); }
     313            /// Moveconstructor: Moves the value and its type from the other MultiType
     314            inline MultiType(MultiType&& other)      : value_(nullptr) { std::swap(this->value_, other.value_); };
    312315
    313316            /// Destructor: Deletes the MT_Value.
     
    320323            /// Assigns the value of the other MultiType and converts it to the current type of the MultiType.
    321324            inline                       MultiType& operator=(const MultiType& other) { this->set(other); return (*this); }
     325            /// Moves the value and the type of the other MultiType to this one.
     326            inline                       MultiType& operator=(MultiType&& other)      { std::swap(this->value_, other.value_); return (*this); }
    322327
    323328            /// Assigns the given value and converts it to the current type.
Note: See TracChangeset for help on using the changeset viewer.