template<typename T> class Array
{
private:
T errValCopy;
public:
T __errVal__;
uint16 __size__;
T* __ptr__;
Array(const T& errorValue);
Array(const Array<T>& other);
~Array();
};
template<typename T> Array<T>::Array(const T& errorValue):
__ptr__(new T[1]), __size__(0), __errVal__(errorValue) { }
template<typename T> Array<T>::Array(const Array<T>& other)
{
if (other.__size__ > 0)
{
__size__ = other.__size__;
ptr = new T[__size__];
for (uint16 i = 0; i < __size__; i++)
{ __ptr__[i] = other.__ptr__[i]; }
}
else
{
size = 0;
ptr = new T[1];
}
__errVal__ = other.__errVal__;
}
template<typename T> Array<T>::~Array()
{
if (__ptr__ != 0)
{ __ptr__ = 0; delete[] __ptr__; }
}
Wwhen I try to run the following code: Array<Array<int>> a(Array<int>(-1));
The error log tells me there is no appropriate default constructor available.
If I understand it correctly, "default constructor" refers to the constructor which lets you just write Array<int> a; instead of Array<int> a(...);, but I can't see where in the code such a situation occurs...
I'd appreciate any help I can get with this problem as well.