Changeset 3583


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

move constructor and move assignment for omic::BamRead?; refs #878

Location:
trunk/yat/omic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/omic/BamRead.cc

    r3398 r3583  
    3333#include <cstring>
    3434#include <sstream>
     35#include <utility>
    3536
    3637// bam1_seq_seti is not defined in 0.1.18 (or older), so
     
    7879
    7980
     81#ifdef YAT_HAVE_RVALUE
     82  BamRead::BamRead(BamRead&& other)
     83    : bam_(other.bam_)
     84  {
     85    other.bam_ = NULL;
     86  }
     87#endif
     88
     89
    8090  BamRead::~BamRead(void)
    8191  {
     
    90100    return *this;
    91101  }
     102
     103
     104#ifdef YAT_HAVE_RVALUE
     105  BamRead& BamRead::operator=(BamRead&& rhs)
     106  {
     107    this->swap(rhs);
     108    return *this;
     109  }
     110#endif
    92111
    93112
  • trunk/yat/omic/BamRead.h

    r3550 r3583  
    6767    BamRead(const BamRead& other);
    6868
     69#ifdef YAT_HAVE_RVALUE
     70    /**
     71       \brief move constructor
     72     */
     73    BamRead(BamRead&& other);
     74#endif
     75
    6976    /**
    7077       \brief Destructor
     
    7683     */
    7784    const BamRead& operator=(const BamRead& rhs);
     85
     86#ifdef YAT_HAVE_RVALUE
     87    /**
     88       \brief move assignment operator
     89     */
     90    BamRead& operator=(BamRead&& rhs);
     91#endif
    7892
    7993    /**
Note: See TracChangeset for help on using the changeset viewer.