numElementsInArray

Hi Jules!

I’m getting a lot of “Statement has no effect” warnings building on Mac, related to the sizeof(0…) line in this code (GCC 4.2, if that helps!):

	template <typename Type, int N>
	inline int numElementsInArray (Type (&array)[N])
	{
		(void) array; // (required to avoid a spurious warning in MS compilers)
		sizeof (0[array]); // This line should cause an error if you pass an object with a user-defined subscript operator
		return N;
	}

Best wishes,

Pete

That’s odd - why don’t I get those…? Did you turn on a warning flag?