I am trying to write a piece of code that takes an object and pushes it onto the back of a vector, but the objects are not being pushed correctly.
I am writing an OpenGL application and I want to draw many lines in it. In order to store those lines, I first create each line in a C2DPointSet and when I stop drawing, I want to push the current line in my vector of lines. By debugging the code, I saw that the length of the vector after pushing the line is 0 and the same line in the vector has 0 points (which should not be the case). Here is the code:
vector <C2DPointSet> lines; //global variables
C2DPointSet line;
//function that runs if a button is pressed and i click in my glwindow
void lineButtonFunction(int x,int y){
    C2DPoint currentPoint;  
    currentPoint=workspacePoint(x,y);//returns point;s cordinates acording to cursorx,y-it works
    line.AddCopy(currentPoint);//adds a copy of the given point to obj line
}
//code that runs when i am done drawing 
if(buttons[i].getButtonText()=='L'){ 
    lines.push_back(line);
    line.DeleteAll();//empties the obj
}
I don't know what the problem is. With different objects the code would run. I am not sure, but i think that the problem stems from pushing C2DPointSet because it stores as many points as I like. Also, I observed that regardless of how many points I stored in the line I got its size as 12. 
C2DPoints and C2DPointSet are from geolib; information can be found here.
 
     
     
     
    