@@ -116,7 +116,7 @@ struct basic_inlined_vector {
116116 } else if constexpr (std::is_same_v<type, T>) {
117117 return std::addressof (payload) + 1 ;
118118 } else if constexpr (std::is_same_v<type, std::vector<T>>) {
119- return std::addressof (*payload.end () );
119+ return std::addressof (*payload.begin ()) + payload. size ( );
120120 }
121121 }, storage);
122122 }
@@ -127,16 +127,17 @@ struct basic_inlined_vector {
127127
128128 template <typename ... Args>
129129 void emplace_back (Args&& ...args) {
130+ auto & s = storage;
130131 std::visit ([&] (auto & payload) -> void {
131132 using type = std::decay_t <decltype (payload)>;
132133 if constexpr (std::is_same_v<type, std::monostate>) {
133- storage .template emplace <T>(std::forward<Args>(args)...);
134+ s .template emplace <T>(std::forward<Args>(args)...);
134135 } else if constexpr (std::is_same_v<type, T>) {
135- T tmp = std::move (payload);
136- auto & v = storage.template emplace <std::vector<T>>();
136+ std::vector<T> v;
137137 v.reserve (2 );
138- v.emplace_back (std::move (tmp ));
138+ v.emplace_back (std::move (payload ));
139139 v.emplace_back (std::forward<Args>(args)...);
140+ s.template emplace <std::vector<T>>(std::move (v));
140141 } else if constexpr (std::is_same_v<type, std::vector<T>>) {
141142 payload.emplace_back (std::forward<Args>(args)...);
142143 }
0 commit comments