Skip to content

Commit 7fd7d80

Browse files
committed
Vector move constructor
1 parent 7c07c36 commit 7fd7d80

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Platforms/Vector.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,15 @@ class Vector {
125125
}
126126
}
127127

128-
inline Vector(Vector<T> &&moveFrom) = default;
128+
inline Vector(Vector<T> &&moveFrom) {
129+
// move constructor
130+
this->p_data = moveFrom.p_data;
131+
this->len = moveFrom.len;
132+
this->bufferLen = moveFrom.bufferLen;
133+
moveFrom.p_data = nullptr; // avoid double delete
134+
moveFrom.len = 0;
135+
moveFrom.bufferLen = 0;
136+
};
129137

130138

131139
/// copy constructor

0 commit comments

Comments
 (0)