1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

SmallMap, FlatArrayMap::copyFrom

Replaced memcpy with std::copy, since the first one may work improperly with non POD data.

llvm-svn: 158457
This commit is contained in:
Stepan Dyatkovskiy 2012-06-14 16:59:43 +00:00
parent 51b8e0f412
commit bb6d2dc9da

View File

@ -96,11 +96,13 @@ namespace llvm {
void copyFrom(const self &RHS) {
memcpy(Array, RHS.Array, sizeof(value_type) * (MaxArraySize + 1));
std::copy(RHS.Array, RHS.Array + MaxArraySize + 1, Array);
NumElements = RHS.NumElements;
}
void init () {
// Even if Array contains non POD, use memset for last element,
// since it is used as end() iterator only.
memset(Array + MaxArraySize, 0, sizeof(value_type));
NumElements = 0;
}