Array Length

Might as well make 'length' static as the class and array are bound to it.

template<class T, size_t len> struct ary {
  T& operator[](size_t i) { return data[i]; }
  enum{ length = len };
  T data[length];
};

//...
ary< int, 4 > a = { 0, 1, 2, 3 };

//..
Serial.print( "Len: " );
Serial.println( a.length );

Also, with a conversion operator it now behaves exactly like an array when passed to functions expecting a pointer. ( would be unsafe if 'length' was not a constant. )

template<class T, size_t len> struct ary {
  T& operator[](size_t i) { return this->data[i]; }
  operator T*(){ return this->data; }
  enum{ length = len };
  T data[length];
};

//...
ary< char, 4 > a = { 'a', 'b', 'c', '\0' };

//...
Serial.print( a );

EDIT: Also, as it mixes dependant & non-dependant names 'this->' should be used to prevent global non-dependant names from resolving.