Changeset 3585


Ignore:
Timestamp:
Jan 19, 2017, 6:01:19 AM (5 years ago)
Author:
Peter
Message:

move constructor and move assignment for utility::Matrix; refs #878

Location:
trunk/yat/utility
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/Matrix.cc

    r2881 r3585  
    6868  {
    6969  }
     70
     71
     72#ifdef YAT_HAVE_RVALUE
     73  Matrix::Matrix(Matrix&& other)
     74    : blas_result_(NULL), m_(NULL)
     75  {
     76    std::swap(m_, other.m_);
     77  }
     78#endif
    7079
    7180
     
    431440
    432441
     442#ifdef YAT_HAVE_RVALUE
     443  Matrix& Matrix::operator=(Matrix&& other)
     444  {
     445    std::swap(m_, other.m_);
     446    return *this;
     447  }
     448#endif
     449
     450
    433451  const Matrix& Matrix::operator+=(const Matrix& other)
    434452  {
  • trunk/yat/utility/Matrix.h

    r2735 r3585  
    2626  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2727*/
     28
     29#include "config_public.h"
    2830
    2931#include "Exception.h"
     
    141143    Matrix(const Matrix&);
    142144
     145#ifdef YAT_HAVE_RVALUE
     146    /**
     147       \brief The move constructor.
     148    */
     149    Matrix(Matrix&&);
     150#endif
     151
    143152    /**
    144153       \brief The istream constructor.
     
    432441    */
    433442    const Matrix& operator=(const Matrix& other);
     443
     444#ifdef YAT_HAVE_RVALUE
     445    /**
     446       \brief Move assignment operator
     447     */
     448    Matrix& operator=(Matrix&& other);
     449#endif
    434450
    435451    /**
Note: See TracChangeset for help on using the changeset viewer.