dmlc / dmlc/ps-lite

more standard implementation of SArray::operator=

Open
#85 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
1.6k
Forks
540
PR merge metrics
No merged PRs in 30d

Description

It might be better to implement SArray::operator= in a more standard way.

1 template
2 SArray& operator=(const SArray& arr)
3 {
4 if (this == &arr) return *this;
5 size_ = arr.size() * sizeof(W) / sizeof(V);
6 CHECK_EQ(size_ * sizeof(V), arr.size() * sizeof(W));
7 capacity_ = arr.capacity() * sizeof(W) / sizeof(V);
8 ptr_ = std::shared_ptr(arr.ptr(), reinterpret_cast(arr.data()));
9 }

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.