Code:
template< class Type, UInt32 Elements >
class MTrArrayType
{
private:
Type Array[Elements];
public:
Type& operator [] ( UInt32 Index )
{
if( Index >= Elements )
{
cout << "Index out of range: " << Index << "/" << Elements << endl;
return Array[0];
}
return Array[Index];
}
operator Type*()
{
return Array;
}
};
This is my class. It's an ordinary array class, all it does is check if the index is out of bounds.
When I put in...
Code:
MTrArrayType< int, 3 > MyArray;
MyArray[1] = 6;
..., how do I know which operator function it calls? The one to change it to a Type*, or the one to do the index thing? If it's the one i don't want, how do I change it?
Thanks!