File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
include/beman/inplace_vector Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -138,13 +138,19 @@ template <class T, size_t N> struct trivial {
138138 constexpr ~trivial () = default ;
139139};
140140
141+ // This is the base storage for non-trivial types.
142+ // In this storage solution, elements are stored in type-erased byte storage,
143+ // thus, reinterpret_cast must be used,
144+ // which makes inplace_vector of non-trivial types non-constexpr-friendly.
145+ //
146+ // Note: This is not used if trivial union is supported.
141147template <class T , size_t N> struct raw_byte_based_storage {
142148 alignas (T) std::byte _d[sizeof (T) * N];
143- constexpr T *storage_data (size_t i) noexcept {
149+ T *storage_data (size_t i) noexcept {
144150 IV_EXPECT (i < N);
145151 return reinterpret_cast <T *>(_d) + i;
146152 }
147- constexpr const T *storage_data (size_t i) const noexcept {
153+ const T *storage_data (size_t i) const noexcept {
148154 IV_EXPECT (i < N);
149155 return reinterpret_cast <const T *>(_d) + i;
150156 }
You can’t perform that action at this time.
0 commit comments