mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
SmallMap, FlatArrayMap::copyFrom
Replaced memcpy with std::copy, since the first one may work improperly with non POD data. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158457 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
722f2544b2
commit
cba91230c0
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user