boostorg / boostorg/histogram

storage_adaptor<std::vector> missing efficient move assignment from std::vector

Open
#338 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
334
Forks
76
PR merge metrics
No merged PRs in 30d

Description

Often times to extend the behaviour of `boost::histogram`, we need unsafe access to storage. And there is one performance issue with working with storage_adaptor.
My use case can be simplified to:
```cpp
auto hist = make_histogram_with(std::vector(), axis::regular(100, 0, 100));
auto& storage = unsafe_access::storage(hist);
storage = std::vector(1000);
```
The `storage = std::vector(1000);` line would not call the move assignment operator, but rather `vector_impl::operator=(const U& u)`, which copies the values instead of just swapping the data pointer.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.