File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
include/beman/inplace_vector Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -139,15 +139,17 @@ template <class T, size_t N> struct trivial {
139139 constexpr ~trivial () = default ;
140140};
141141
142- template <class T , size_t N> struct raw_byte_based_storage {
143- alignas (T) std::byte _d[sizeof (T) * N];
144- constexpr T *storage_data (size_t i) noexcept {
142+ template <class T , std::size_t N> union raw_byte_based_storage {
143+ T _d[N];
144+ constexpr raw_byte_based_storage () {}
145+ constexpr ~raw_byte_based_storage () {}
146+ constexpr T *storage_data (std::size_t i) noexcept {
145147 IV_EXPECT (i < N);
146- return reinterpret_cast <T *>(_d) + i;
148+ return _d + i;
147149 }
148- constexpr const T *storage_data (size_t i) const noexcept {
150+ constexpr const T *storage_data (std:: size_t i) const noexcept {
149151 IV_EXPECT (i < N);
150- return reinterpret_cast < const T *>(_d) + i;
152+ return _d + i;
151153 }
152154};
153155
You can’t perform that action at this time.
0 commit comments