Zdravim!
mam nasledujici kod:
template <class Type>
class Vector
{
Type * buffer;
int size, capacity;
....
public:
Vector();
....
friend ostream& operator<<(ostream&, Vector&);
....
int length() const;
};
....
....
template <class Type>
ostream & operator<<(ostream& o, Vector<Type>& v)
{
o << "(";
for (int i = 0; i < v.length(); i++)
{
o << v[i];
if (i < v.length() - 1)
o << ", ";
}
o << ")"<< endl;
return o;
}
....
....
int main(int argc, char *argv[])
{
Vector<int> a;
cout << a;
}
Bez problemu to zkompiluju bez toho posledniho radku - cout << a. Jakmile ho tam ale pridam, vyhodi to nejaky fatal error (pripadne ho sem napisu). Nevim si s tim rady.
Diky za odpovedi