Hi,
i would like to know if it`s possible to get a std::shared_ptr from "this".
Let`s asume the following code, using standard-pointer:
1 2 3 4 5 6 7 8 9
|
void AbstractRenderWindow::render(AbstractRenderWindow* pRenderWindow)
{
AbstractContainer::render(pRenderWindow);
}
void AbstractRenderWindow::renderLoop()
{
this->render(this);
}
|
This works, but now i would like to pass a std::shared_ptr to my base-class function:
1 2 3 4 5 6 7 8 9
|
void AbstractRenderWindow::render(std::shared_ptr<AbstractRenderWindow> pRenderWindow)
{
AbstractContainer::render(pRenderWindow);
}
void AbstractRenderWindow::renderLoop()
{
this->render(this); // <--- ???
}
|
Normally this is not a problem, since i just have to pass the already known shared_ptr. But i have a special case in the root class (the RenderWindow) which inhertiances from AbstractContainer and this from AbstractControl.
So i have to call render(this) in that special case. I asked google and found a solution, to use a shared_ptr with getPtr(), but this does`nt seem to work on "this".
Is this possible what i want to do? Or do i have to pass my shared_ptr of that instance to the ctor from the calling class?
Please excuse my low english.
Thanks for all tips in advance,
Mathias