Skip to content

Commit ef483dd

Browse files
committed
[RF] Implement move constructor for RooAbsCollection and RooArgSet
1 parent d8193ca commit ef483dd

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

roofit/roofitcore/inc/RooAbsCollection.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ class RooAbsCollection : public TObject, public RooPrintable {
5252
RooAbsCollection& assignValueOnly(const RooAbsCollection& other, Bool_t oneSafe=kFALSE) ;
5353
void assignFast(const RooAbsCollection& other, Bool_t setValDirty=kTRUE) ;
5454

55+
// Move constructor
56+
RooAbsCollection(RooAbsCollection && other);
57+
5558
// Copy list and contents (and optionally 'deep' servers)
5659
RooAbsCollection *snapshot(Bool_t deepCopy=kTRUE) const ;
5760
Bool_t snapshot(RooAbsCollection& output, Bool_t deepCopy=kTRUE) const ;

roofit/roofitcore/inc/RooArgList.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ class RooArgList : public RooAbsCollection {
6161
// to a copied list. The variables in the copied list are independent
6262
// of the original variables.
6363
RooArgList(const RooArgList& other, const char *name="");
64+
/// Move constructor.
65+
RooArgList(RooArgList && other) : RooAbsCollection(std::move(other)) {}
6466
virtual TObject* clone(const char* newname) const { return new RooArgList(*this,newname); }
6567
virtual TObject* create(const char* newname) const { return new RooArgList(newname); }
6668
RooArgList& operator=(const RooArgList& other) { RooAbsCollection::operator=(other) ; return *this ; }

roofit/roofitcore/inc/RooArgSet.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ class RooArgSet : public RooAbsCollection {
7474
}
7575

7676
RooArgSet(const RooArgSet& other, const char *name="");
77+
/// Move constructor.
78+
RooArgSet(RooArgSet && other) : RooAbsCollection(std::move(other)) {}
7779

7880
RooArgSet(const RooArgSet& set1, const RooArgSet& set2,
7981
const char *name="");

roofit/roofitcore/src/RooAbsCollection.cxx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,20 @@ RooAbsCollection::RooAbsCollection(const RooAbsCollection& other, const char *na
119119
}
120120

121121

122+
////////////////////////////////////////////////////////////////////////////////
123+
/// Move constructor.
124+
125+
RooAbsCollection::RooAbsCollection(RooAbsCollection&& other) :
126+
TObject(other),
127+
RooPrintable(other),
128+
_list(std::move(other._list)),
129+
_ownCont(other._ownCont),
130+
_name(std::move(other._name)),
131+
_allRRV(other._allRRV),
132+
_sizeThresholdForMapSearch(other._sizeThresholdForMapSearch)
133+
{
134+
}
135+
122136

123137
////////////////////////////////////////////////////////////////////////////////
124138
/// Destructor

0 commit comments

Comments
 (0)