|
@@ -295,10 +295,16 @@ public:
|
|
|
|
|
|
operator Vector<T>() const {
|
|
operator Vector<T>() const {
|
|
Vector<T> ret;
|
|
Vector<T> ret;
|
|
- ret.resize(size());
|
|
|
|
|
|
+ ret.resize(count);
|
|
T *w = ret.ptrw();
|
|
T *w = ret.ptrw();
|
|
if (w) {
|
|
if (w) {
|
|
- memcpy(w, data, sizeof(T) * count);
|
|
|
|
|
|
+ if constexpr (std::is_trivially_copyable_v<T>) {
|
|
|
|
+ memcpy(w, data, sizeof(T) * count);
|
|
|
|
+ } else {
|
|
|
|
+ for (U i = 0; i < count; i++) {
|
|
|
|
+ w[i] = data[i];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|