Skip to content

Commit

Permalink
Bug 1216040 - Make ArrayLength support mozilla::EnumeratedArray. r=fr…
Browse files Browse the repository at this point in the history
…oydnj
  • Loading branch information
heycam committed Oct 19, 2015
1 parent 4fa140e commit 8df7b92
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mfbt/ArrayUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "mozilla/Alignment.h"
#include "mozilla/Array.h"
#include "mozilla/EnumeratedArray.h"
#include "mozilla/TypeTraits.h"

namespace mozilla {
Expand Down Expand Up @@ -64,6 +65,13 @@ ArrayLength(const Array<T, N>& aArr)
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.
*
Expand Down

0 comments on commit 8df7b92

Please sign in to comment.