I have a question and that is that in List, vector and/or shared_ptr/unique_ptr you can pass classes as objects as well as pointers. I do not understand now when one would use e.g shared_ptr<Shape*> pShape;? When does it make sense to pass e.g. in the case the class Shape as a pointer and when not?
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#include <iostream>
#include "CAD_Drawing.h"
...
void CAD::CAD_Drawing::vDrawIt(void)
{
for (auto it : CAD::CAD_Drawing::setShapes_)
{
it->vDraw();
}
}
void CAD::CAD_Drawing::vAddShape(std::shared_ptr<Shape> pShape)
{
setShapes_.insert(pShape);
}
void CAD::CAD_Drawing::vRemoveShape(std::shared_ptr<Shape> pShape)
{
setShapes_.erase(pShape);
}