Bug 968520 - Add more fallible variants of nsTArray::InsertElementsAt. r=froydnj

This commit is contained in:
Birunthan Mohanathas 2015-06-09 17:27:31 -07:00
parent c84827bad2
commit 67cae0519f

View File

@ -1292,19 +1292,37 @@ public:
}
// A variation on the ReplaceElementsAt method defined above.
template<class Item>
template<class Item, typename ActualAlloc = Alloc>
elem_type* InsertElementsAt(index_type aIndex, const Item* aArray,
size_type aArrayLen)
{
return ReplaceElementsAt(aIndex, 0, aArray, aArrayLen);
return ReplaceElementsAt<Item, ActualAlloc>(aIndex, 0, aArray, aArrayLen);
}
template<class Item>
/* MOZ_WARN_UNUSED_RESULT */
elem_type* InsertElementsAt(index_type aIndex, const Item* aArray,
size_type aArrayLen, const mozilla::fallible_t&)
{
return InsertElementsAt<Item, FallibleAlloc>(aIndex, aArray, aArrayLen);
}
// A variation on the ReplaceElementsAt method defined above.
template<class Item, class Allocator>
template<class Item, class Allocator, typename ActualAlloc = Alloc>
elem_type* InsertElementsAt(index_type aIndex,
const nsTArray_Impl<Item, Allocator>& aArray)
{
return ReplaceElementsAt(aIndex, 0, aArray.Elements(), aArray.Length());
return ReplaceElementsAt<Item, ActualAlloc>(
aIndex, 0, aArray.Elements(), aArray.Length());
}
template<class Item, class Allocator>
/* MOZ_WARN_UNUSED_RESULT */
elem_type* InsertElementsAt(index_type aIndex,
const nsTArray_Impl<Item, Allocator>& aArray,
const mozilla::fallible_t&)
{
return InsertElementsAt<Item, Allocator, FallibleAlloc>(aIndex, aArray);
}
// Insert a new element without copy-constructing. This is useful to avoid