Rewrite RangedPtr's constructor accepting a C-style array in C++, no bug, rs=Waldo
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 14 Jan 2013 19:48:42 -0500
changeset 118831 77a16513b467f18dbdef3bce43d12ce946dbc9d5
parent 118830 1222416519a8708df0ced6bfe51f7a8f66c87a53
child 118832 f7900eca0a30bc59892cbde432411a4f9aaf8c34
push id24180
push useremorley@mozilla.com
push dateTue, 15 Jan 2013 22:58:27 +0000
treeherdermozilla-central@72e34ce7fd92 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersWaldo
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Rewrite RangedPtr's constructor accepting a C-style array in C++, no bug, rs=Waldo This will let the compiler correctly deduce N without making the caller explicitly pass it in.
mfbt/RangedPtr.h
--- a/mfbt/RangedPtr.h
+++ b/mfbt/RangedPtr.h
@@ -95,17 +95,17 @@ class RangedPtr
     {
       MOZ_ASSERT(length <= size_t(-1) / sizeof(T));
       MOZ_ASSERT(uintptr_t(rangeStart) + length * sizeof(T) >= uintptr_t(rangeStart));
       checkSanity();
     }
 
     /* Equivalent to RangedPtr(arr, arr, N). */
     template<size_t N>
-    RangedPtr(T arr[N])
+    RangedPtr(T (&arr)[N])
       : ptr(arr)
 #ifdef DEBUG
       , rangeStart(arr), rangeEnd(arr + N)
 #endif
     {
       checkSanity();
     }