Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tree/ntuple/inc/ROOT/RFieldBase.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -891,8 +891,8 @@ public:
~RBulkValues();
RBulkValues(const RBulkValues &) = delete;
RBulkValues &operator=(const RBulkValues &) = delete;
RBulkValues(RBulkValues &&other);
RBulkValues &operator=(RBulkValues &&other);
RBulkValues(RBulkValues &&other) = default;
RBulkValues &operator=(RBulkValues &&other) = default;

// Sets `fValues` and `fSize`/`fCapacity` to the given values. The capacity is specified in number of values.
// Once a buffer is adopted, an attempt to read more values then available throws an exception.
Expand Down
29 changes: 0 additions & 29 deletions tree/ntuple/src/RFieldBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -122,35 +122,6 @@ void ROOT::RFieldBase::RValue::BindRawPtr(void *rawPtr)

//------------------------------------------------------------------------------

ROOT::RFieldBase::RBulkValues::RBulkValues(RBulkValues &&other)
: fField(other.fField),
fValueSize(other.fValueSize),
fCapacity(other.fCapacity),
fSize(other.fSize),
fIsAdopted(other.fIsAdopted),
fNValidValues(other.fNValidValues),
fFirstIndex(other.fFirstIndex)
{
std::swap(fDeleter, other.fDeleter);
std::swap(fValues, other.fValues);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this swap is necessary, otherwise the pointer may just get copied and we'd end up freeing the values twice in the destructor, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, that's a good point - I found this code because our coverage report says we're not testing it at all, so maybe we should do this and see.

std::swap(fMaskAvail, other.fMaskAvail);
}

ROOT::RFieldBase::RBulkValues &ROOT::RFieldBase::RBulkValues::operator=(RBulkValues &&other)
{
std::swap(fField, other.fField);
std::swap(fDeleter, other.fDeleter);
std::swap(fValues, other.fValues);
std::swap(fValueSize, other.fValueSize);
std::swap(fCapacity, other.fCapacity);
std::swap(fSize, other.fSize);
std::swap(fIsAdopted, other.fIsAdopted);
std::swap(fMaskAvail, other.fMaskAvail);
std::swap(fNValidValues, other.fNValidValues);
std::swap(fFirstIndex, other.fFirstIndex);
return *this;
}

ROOT::RFieldBase::RBulkValues::~RBulkValues()
{
if (fValues)
Expand Down
Loading