Skip to content

Commit

Permalink
Got rid of a static_cast, and minor formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
OleErikPeistorpet committed Jun 26, 2024
1 parent f3520c0 commit 16c3716
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions dynarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -625,10 +625,8 @@ typename dynarray<T, Alloc>::iterator
else
{ pPos = _emplaceRealloc(pPos, reinterpret_cast<T &>(tmp));
}
std::memcpy( // relocate the new element to pos
static_cast<void *>(pPos),
static_cast<const void *>(&tmp),
sizeof(T) );
std::memcpy(static_cast<void *>(pPos), &tmp, sizeof(T)); // relocate the new element to pos

return _detail::MakeDynarrIter(_m, pPos);
}

Expand Down Expand Up @@ -855,8 +853,8 @@ inline typename dynarray<T, Alloc>::iterator dynarray<T, Alloc>::unordered_eras
--_m.end;
_debugSizeUpdater guard{_m};

auto & mem = reinterpret_cast<storage_for<T> &>(elem);
mem = *reinterpret_cast<storage_for<T> *>(_m.end); // relocate last element to pos
auto & mem = reinterpret_cast< storage_for<T> & >(elem);
mem = *reinterpret_cast< storage_for<T> * >(_m.end); // relocate last element to pos
}
else
{ *pos = std::move(back());
Expand Down

0 comments on commit 16c3716

Please sign in to comment.