@@ -16,7 +16,7 @@ namespace rsx
1616 };
1717
1818 template <typename Ty>
19- requires std::is_trivially_destructible_v<Ty>
19+ requires std::is_trivially_destructible_v<Ty> && std::is_trivially_copyable_v<Ty>
2020 struct simple_array
2121 {
2222 public:
@@ -178,24 +178,11 @@ namespace rsx
178178 return ;
179179 }
180180
181- if constexpr (std::is_trivially_copyable_v<Ty>)
182- {
183- // Use memcpy to allow compiler optimizations
184- Ty _stack_alloc[_local_capacity];
185- std::memcpy (_stack_alloc, that._data , that.size_bytes ());
186- std::memcpy (that._data , _data, size_bytes ());
187- std::memcpy (_data, _stack_alloc, that.size_bytes ());
188- }
189- else
190- {
191- // Safe path: use element-wise std::swap
192- const usz count = std::max (size (), that.size ());
193- for (usz i = 0 ; i < count; ++i)
194- {
195- std::swap (_data[i], that._data [i]);
196- }
197- }
198-
181+ // Use memcpy to allow compiler optimizations
182+ Ty _stack_alloc[_local_capacity];
183+ std::memcpy (_stack_alloc, that._data , that.size_bytes ());
184+ std::memcpy (that._data , _data, size_bytes ());
185+ std::memcpy (_data, _stack_alloc, that.size_bytes ());
199186 std::swap (_size, that._size );
200187 }
201188
0 commit comments