more standard implementation of SArray::operator=
Open
- 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.