Browse Source

MathsFunctions: Made numElementsInArray constexpr

tags/2021-05-28
reuk Tom Poole 6 years ago
parent
commit
e5ce2ceb97
1 changed files with 1 additions and 6 deletions
  1. +1
    -6
      modules/juce_core/maths/juce_MathsFunctions.h

+ 1
- 6
modules/juce_core/maths/juce_MathsFunctions.h View File

@@ -297,12 +297,7 @@ void ignoreUnused (Types&&...) noexcept {}
@endcode
*/
template <typename Type, int N>
int numElementsInArray (Type (&array)[N])
{
(void) array;
(void) sizeof (0[array]); // This line should cause an error if you pass an object with a user-defined subscript operator
return N;
}
JUCE_CONSTEXPR int numElementsInArray (Type (&)[N]) noexcept { return N; }
//==============================================================================
// Some useful maths functions that aren't always present with all compilers and build settings.


Loading…
Cancel
Save