chromium / subspace

A concept-centered standard library for C++20, enabling safer and more reliable products and a more modern feel for C++ code.; Also home of Subdoc the code-documentation generator.
https://suslib.cc
Apache License 2.0
89 stars 15 forks source link

Use std::launder when converting unsigned char* to T* #261

Closed danakj closed 1 year ago

danakj commented 1 year ago

See the impl here: https://en.cppreference.com/w/cpp/types/aligned_storage Which references: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0137r1.html

Also.. change from char[N] to unsigned char[N].

This needs to happen in the Iterator type erasure code: https://github.com/chromium/subspace/blob/main/subspace/iter/sized_iterator.h#L80

danakj commented 1 year ago

https://github.com/chromium/subspace/commit/f667a462c2ced418a76ba62b722d378a99a62b66