Changeset 4068


Ignore:
Timestamp:
Aug 6, 2021, 1:28:50 AM (11 months ago)
Author:
Peter
Message:

implement move constructor and assignment for Kendall class.

Location:
branches/kendall-score/yat/statistics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/kendall-score/yat/statistics/Kendall.cc

    r4064 r4068  
    3838#include <map>
    3939#include <set>
     40#include <utility>
    4041#include <vector>
    4142
     
    170171
    171172
     173  Kendall::Kendall(Kendall&& rhs)
     174    : pimpl_(rhs.pimpl_)
     175  {
     176    rhs.pimpl_ = nullptr;
     177  }
     178
     179
    172180  Kendall::~Kendall(void)
    173181  {
     
    234242    assert(rhs.pimpl_);
    235243    *pimpl_ = *rhs.pimpl_;
     244    return *this;
     245  }
     246
     247
     248  Kendall& Kendall::operator=(Kendall&& rhs)
     249  {
     250    std::swap(pimpl_, rhs.pimpl_);
    236251    return *this;
    237252  }
  • branches/kendall-score/yat/statistics/Kendall.h

    r2766 r4068  
    4444     */
    4545    Kendall(const Kendall& other);
     46
     47    /**
     48       \brief Move constructor
     49     */
     50    Kendall(Kendall&& other);
    4651
    4752    /**
     
    121126     */
    122127    Kendall& operator=(const Kendall& rhs);
     128
     129    /**
     130       \brief move assignment operator
     131     */
     132    Kendall& operator=(Kendall&& rhs);
    123133  private:
    124134    class Pimpl;
Note: See TracChangeset for help on using the changeset viewer.