Bug 1216040 - Make ArrayLength support mozilla::EnumeratedArray. r=froydnj

This commit is contained in:
Cameron McCormack 2015-10-20 10:16:20 +11:00
parent 0046a1f79e
commit c0513349d0

View File

@ -20,6 +20,7 @@
#include "mozilla/Alignment.h" #include "mozilla/Alignment.h"
#include "mozilla/Array.h" #include "mozilla/Array.h"
#include "mozilla/EnumeratedArray.h"
#include "mozilla/TypeTraits.h" #include "mozilla/TypeTraits.h"
namespace mozilla { namespace mozilla {
@ -64,6 +65,13 @@ ArrayLength(const Array<T, N>& aArr)
return N; return N;
} }
template<typename E, E N, typename T>
MOZ_CONSTEXPR size_t
ArrayLength(const EnumeratedArray<E, N, T>& aArr)
{
return size_t(N);
}
/* /*
* Compute the address one past the last element of a constant-length array. * Compute the address one past the last element of a constant-length array.
* *