Skip to content

Commit 56575c2

Browse files
committed
[ntuple] fix moving of RNTupleCollectionView
1 parent f912a2a commit 56575c2

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tree/ntuple/inc/ROOT/RNTupleView.hxx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,20 @@ private:
362362

363363
public:
364364
RNTupleCollectionView(const RNTupleCollectionView &other) = delete;
365-
RNTupleCollectionView(RNTupleCollectionView &&other) = default;
366365
RNTupleCollectionView &operator=(const RNTupleCollectionView &other) = delete;
367-
RNTupleCollectionView &operator=(RNTupleCollectionView &&other) = default;
366+
RNTupleCollectionView(RNTupleCollectionView &&other)
367+
: fSource(other.fSource), fField(std::move(other.fField)), fValue(fField.CreateValue())
368+
{
369+
}
370+
RNTupleCollectionView &operator=(RNTupleCollectionView &&other)
371+
{
372+
if (this == &other)
373+
return *this;
374+
std::swap(fSource, other.fSource);
375+
std::swap(fField, other.fField);
376+
fValue = fField.CreateValue();
377+
return *this;
378+
}
368379
~RNTupleCollectionView() = default;
369380

370381
ROOT::RNTupleLocalRange GetCollectionRange(ROOT::NTupleSize_t globalIndex)

0 commit comments

Comments
 (0)