I have this class. Whenever I call the constructor, it gets called, for instance, with segments = 4
. I get in Segments
the address just for the first element instead of 4.
This is from clion debugger:
class Image{
LinkedList<int,int> UnLabeledSegments;
int* Segments;
int NumOfSegments;
public:
explicit Image(int segments);
~Image();
};
Image::Image(int segments):Segments(new int[segments]),NumOfSegments(segments){
for(int i = 0; i < segments;i++){
this->UnLabeledSegments.insert(i,-1);
this->Segments[i] = -1;
}
}
This is how I call the constructor the container is simple BST dictionary
void ImageTagger::AddImage(int ImageID) {
ImageContainer.insert(ImageID,(new Image(ImageSegments)));
}