I've been playing around with a class that wraps around a fixed-size array (note this isn't for serious use). Because I want to be able to treat the Array objects basically like you would a normal stack allocated array, I've allowed the Array class to implicitly convert to a pointer.

The Array class:

Code:
template<typename T, std::size_t size>
class Array
{
public:
  const std::size_t elements;

  explicit Array(const T& initialValue = T( ))
    : elements(size)
  {
    std::fill(m_data, m_data + size, initialValue);
  }

  Array(const Array& copy)
    : elements(size)
  {
    std::copy(copy.m_data, copy.m_data + size, m_data);
  }

  const Array& operator=(const Array& rhs)
  {
    std::copy(rhs.m_data, rhs.m_data + size, m_data);
    return *this;
  }

  template<typename T, std::size_t otherSize>
  Array(const Array<T, otherSize>& copy)
    : elements(size)
  {
    const T* copyData = copy;
    std::copy(copyData, copyData + (size < otherSize ? size : otherSize), m_data);
  }

  template<typename T, std::size_t otherSize>
  const Array& operator=(const Array<T, otherSize>& rhs)
  {
    const T* rhsData = rhs;
    std::copy(rhsData, rhsData + (size < otherSize ? size : otherSize), m_data);
    return *this;
  }

  const T& operator[](std::size_t index) const
  {
    assert(index < size);
    return m_data[index];
  }

  T& operator[](std::size_t index)
  {
    return const_cast<T&>(static_cast<const Array&>(*this)[index]);
  }

  operator const T*( ) const
  {
    return m_data;
  }

  operator T*( )
  {
    return m_data;
  }

private:
  T m_data[size];
};
The problem I'm running into is if you try to make multi-dimensional arrays and access them with operator[]. Eg:

Code:
Array<Array<int, 5>, 5> a;
a[0][0] = 1;
The second line generates an error because the compiler can't decide whether to call Array:perator[], or to convert the array to a pointer and call built-in operator[]. Is there some way to get around the problem and prevent the conversion in this instance, or to force Array:perator[] to be called (without explicitly doing a.operator[](0).operator[](0))?