boostorg / boostorg/fusion

Consider making containers trivially copyable when possible

Open
#173 12 comments 1 reaction 2 assignees Claimed by @djowel View on GitHub
Dominant language
C++
Stars
50
Forks
68
PR merge metrics
No merged PRs in 30d

Description

In principle, there is no fundamental reasons that a container of `trivially_copyable` elements can not be made `trivially_copyable`. This feature can be useful for optimizing and make safe certain operations for applications that access memory directly.

```
#include
int main(){
assert((std::is_trivially_copyable>::value));
}
```
I understand the implementation can be tricky and `std::pair` and `std::tuple` have this "defect".
Simple "tuples" such as `std::complex` and `std::array` do not have this problem, showing that it is possible.

Some material:
https://stackoverflow.com/questions/49120246/which-type-trait-would-indicate-that-type-is-memcpy-assignable-tuple-pair/49142680?noredirect=1#comment85373972_49142680

https://groups.google.com/a/isocpp.org/forum/#!topic/std-discussion/PUZ9WUr2AOU

https://groups.google.com/a/isocpp.org/forum/#!msg/std-proposals/Zi2wriFMFvI/N1JlOE-FBQAJ

https://stackoverflow.com/questions/38779985/why-cant-stdtupleint-be-trivially-copyable?noredirect=1&lq=1

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.