I have a wrapper class that delegates its work to a pimpl, and the pimpl is a pointer to a baseclass/interface with no data that is specialized in several different ways.
Like this:
class Base
{
void doStuff=0;
};
class Derived
{
int x,y;
void doStuff()
{
x = (x+y*2)*x; //whatever
}
};
class Wrapper
{
Base* _pimpl;
void doStuff()
{
_pimpl->doStuff();
}
};
Now this works fine most of the time, but when going into the debugger I can't view x,y of the Derived class (because it could be anything). Normally this is irrelevant, but when something goes wrong seeing the state of Derived can be important, but pimpl obscures the state too much (however that's the original idea of a pimpl, so I guess I can't really complain).
Now I have a tostring() function that prints the state out for debug purposes, but was wondering if there is a better solution, to debug this sort of construct in VisualStudio in particular, but a general solution would be better.
Thanks