Hi !
I try to save a shapes from a vector to a file. When I compile a code I get a very large error that begin:
"C:/Qt2009_02/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bits/stream_iterator.h: In member fu
nction `std:stream_iterator<_Tp, _CharT, _Traits>& std:stream_iterator<_Tp, _CharT, _Traits>:perator=(const _Tp&) [wi
th _Tp = const ShapePtr, _CharT = char, _Traits = std::char_traits<char>]':" ...
Here is Main (NewShapes.cpp):
Code:
#include <vector>
#include <fstream>
#include <iterator>
#include <string>
#include "Vertex.h"
#include "ShapePtr.cpp"
using namespace std;
main() {
vector<ShapePtr> shapevec;
Vertex varr[] = { Vertex(0,0), Vertex(10,0), Vertex(5,2), Vertex(5,5) };
shapevec.push_back( ShapePtr(new Polygon(1, 4, varr, 4)) );
shapevec.push_back( ShapePtr(new Circle(5, 5, 4)) );
shapevec.push_back( ShapePtr(new Rectangle(4, 10, 2, 4)) );
shapevec.push_back( ShapePtr(new Point(6, 7, 1)) );
ofstream os("fil.dat");
ostream_iterator<const ShapePtr> shapeout(os, "\n");
copy(shapevec.begin(), shapevec.end(), shapeout);
os.close();
}
What I'm missing, I wander.
Thank You in advance.
Adalte.
Pd: I attached the files with code (NewShapes.cpp, ShapePtr.h, ShapePtr.cpp, Vertex.h) and full error message.