Skip to content
Permalink
Browse files

Implement move assignment operator for QgsExpressionContext

  • Loading branch information
nyalldawson committed Aug 15, 2016
1 parent 786b77a commit 2d191f66a0697be7dd7f31ecc77f1813a70e6b8e
Showing with 17 additions and 0 deletions.
  1. +15 −0 src/core/qgsexpressioncontext.cpp
  2. +2 −0 src/core/qgsexpressioncontext.h
@@ -217,6 +217,21 @@ QgsExpressionContext::QgsExpressionContext( const QgsExpressionContext& other )
mCachedValues = other.mCachedValues;
}

QgsExpressionContext& QgsExpressionContext::operator=( QgsExpressionContext && other )
{
if ( this != &other )
{
qDeleteAll( mStack );
// move the stack over
mStack = other.mStack;
other.mStack.clear();

mHighlightedVariables = other.mHighlightedVariables;
mCachedValues = other.mCachedValues;
}
return *this;
}

QgsExpressionContext& QgsExpressionContext::operator=( const QgsExpressionContext & other )
{
qDeleteAll( mStack );
@@ -259,6 +259,8 @@ class CORE_EXPORT QgsExpressionContext

QgsExpressionContext& operator=( const QgsExpressionContext& other );

QgsExpressionContext& operator=( QgsExpressionContext && other );

~QgsExpressionContext();

/** Check whether a variable is specified by any scope within the context.

1 comment on commit 2d191f6

@m-kuhn

This comment has been minimized.

Copy link
Member

@m-kuhn m-kuhn commented on 2d191f6 Aug 29, 2016

Shouldn't that enforce C++11 or be #ifdef'd?

http://stackoverflow.com/a/31010221/2319028

Please sign in to comment.
You can’t perform that action at this time.