Bug 1319626 - Part 1: Add new nsTArray append method for mozilla::Array. r?nfroyd
MozReview-Commit-ID: BUrCdFtFz3W
--- a/xpcom/glue/nsTArray.h
+++ b/xpcom/glue/nsTArray.h
@@ -1516,16 +1516,22 @@ public:
// @param aArray The elements to append to this array.
// @param aArrayLen The number of elements to append to this array.
// @return A pointer to the new elements in the array, or null if
// the operation failed due to insufficient memory.
protected:
template<class Item, typename ActualAlloc = Alloc>
elem_type* AppendElements(const Item* aArray, size_type aArrayLen);
+ template<class Item, size_t Length, typename ActualAlloc = Alloc>
+ elem_type* AppendElements(const mozilla::Array<Item, Length>& aArray)
+ {
+ return AppendElements<Item, ActualAlloc>(&aArray[0], Length);
+ }
+
public:
template<class Item>
/* MOZ_MUST_USE */
elem_type* AppendElements(const Item* aArray, size_type aArrayLen,
const mozilla::fallible_t&)
{
return AppendElements<Item, FallibleAlloc>(aArray, aArrayLen);