@@ -649,30 +649,6 @@ class nsDefaultComparator {
649
649
bool LessThan (const A& aA, const B& aB) const { return aA < aB; }
650
650
};
651
651
652
- template <bool IsTriviallyCopyConstructible, bool IsSameType>
653
- struct AssignRangeAlgorithm {
654
- template <class Item , class ElemType , class IndexType , class SizeType >
655
- static void implementation (ElemType* aElements, IndexType aStart,
656
- SizeType aCount, const Item* aValues) {
657
- ElemType* iter = aElements + aStart;
658
- ElemType* end = iter + aCount;
659
- for (; iter != end; ++iter, ++aValues) {
660
- nsTArrayElementTraits<ElemType>::Construct (iter, *aValues);
661
- }
662
- }
663
- };
664
-
665
- template <>
666
- struct AssignRangeAlgorithm <true , true > {
667
- template <class Item , class ElemType , class IndexType , class SizeType >
668
- static void implementation (ElemType* aElements, IndexType aStart,
669
- SizeType aCount, const Item* aValues) {
670
- if (aValues) {
671
- memcpy (aElements + aStart, aValues, aCount * sizeof (ElemType));
672
- }
673
- }
674
- };
675
-
676
652
//
677
653
// Normally elements are copied with memcpy and memmove, but for some element
678
654
// types that is problematic. The nsTArray_RelocationStrategy template class
@@ -2434,10 +2410,7 @@ class nsTArray_Impl
2434
2410
// @param aValues The array of elements to copy.
2435
2411
template <class Item >
2436
2412
void AssignRange (index_type aStart, size_type aCount, const Item* aValues) {
2437
- AssignRangeAlgorithm<
2438
- std::is_trivially_copyable_v<Item>,
2439
- std::is_same_v<Item, value_type>>::implementation (Elements (), aStart,
2440
- aCount, aValues);
2413
+ std::uninitialized_copy (aValues, aValues + aCount, Elements () + aStart);
2441
2414
}
2442
2415
};
2443
2416
0 commit comments