Function operator=

Summary

#include <include/bitpropvariant.hpp>

(1) BitPropVariant & operator=(const BitPropVariant &other) NOEXCEPT

(2) BitPropVariant & operator=(BitPropVariant &&other) NOEXCEPT

(3) template <typename T>
    BitPropVariant & operator=(const T &value)

Function overload

Synopsis

#include <include/bitpropvariant.hpp>

BitPropVariant & operator=(const BitPropVariant &other) NOEXCEPT

Description

Copy assignment operator.

Parameters

other - the variant to be copied.

Return
a reference to *this object (with the copied values from other).

Source

Lines 175-179 in src/bitpropvariant.cpp. Line 388 in include/bitpropvariant.hpp.

BitPropVariant& BitPropVariant::operator=( const BitPropVariant& other ) NOEXCEPT {
    BitPropVariant tmp( other ); //copy construct a tmp variable
    *this = std::move( tmp ); //move assign to this
    return *this;
}

Synopsis

#include <include/bitpropvariant.hpp>

BitPropVariant & operator=(BitPropVariant &&other) NOEXCEPT

Description

Move assignment operator.

Parameters

other - the variant to be moved.

Return
a reference to *this object (with the moved values from other).

Source

Lines 181-229 in src/bitpropvariant.cpp. Line 397 in include/bitpropvariant.hpp.

BitPropVariant& BitPropVariant::operator=( BitPropVariant&& other ) NOEXCEPT {
    if ( this != &other ) {
        internalClear();
        vt = other.vt;
        switch ( vt ) {
            case VT_BOOL:
                boolVal = other.boolVal;
                break;
            case VT_BSTR:
                bstrVal = other.bstrVal;
                other.bstrVal = nullptr;
                break;
            case VT_UI1:
                bVal = other.bVal;
                break;
            case VT_UI2:
                uiVal = other.uiVal;
                break;
            case VT_UINT:
                uintVal = other.uintVal;
                break;
            case VT_UI4:
                ulVal = other.ulVal;
                break;
            case VT_UI8:
                uhVal = other.uhVal;
                break;
            case VT_I1:
                cVal = other.cVal;
                break;
            case VT_I2:
                iVal = other.iVal;
                break;
            case VT_INT:
                intVal = other.intVal;
                break;
            case VT_I4:
                lVal = other.lVal;
                break;
            case VT_I8:
                hVal = other.hVal;
                break;
            case VT_FILETIME:
                filetime = other.filetime;
                break;
        }
    }
    return *this;
}

Synopsis

#include <include/bitpropvariant.hpp>

template <typename T>
BitPropVariant & operator=(const T &value)

Description

Assignment operator.

Note
this will work only for T types for which a BitPropVariant constructor is defined!
Parameters

value - the value to be assigned to the object

Return
a reference to *this object having the value as new variant value

Source

Lines 408-412 in include/bitpropvariant.hpp.

template<typename T>
BitPropVariant& operator=( const T& value ) {
    *this = BitPropVariant( value );
    return *this;
}





Add Discussion as Guest

Log in