#ifndef __ARRAY2_H
#define __ARRAY2_H

template<class BaseType, int size = 100>
class Array {
    BaseType member[size];
public:
    class OutOfRangeException: public exception {};
    template<class NumericType>
    BaseType & operator [] (NumericType i) { 
        int j = i;
        if (typeid(NumericType) == typeid(float) ||
            typeid(NumericType) == typeid(double))
            j = (int)(i+0.5);
        return member[j]; 
    }
    template<class NumericType>
    BaseType & at(NumericType i) { 
        int j = i;
        if (typeid(NumericType) == typeid(float) ||
            typeid(NumericType) == typeid(double))
            j = (int)(i+0.5);
        if (j < 0 || j > size) throw OutOfRangeException();
        return member[j];
    }
};

#endif
