I have noticed that many Poco classes have a protected destructor. This makes them more annoying to code with. For example here is some of my code:
struct W2: Poco::Util::WinRegistryConfiguration
{
typedef Poco::Util::WinRegistryConfiguration inherited;
using inherited::inherited;
};
std::string get_documents_folder()
{
W2 regc { "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" };
return regc.getString("Personal", "");
}
Of course, it would be much simpler if I could do away with W2
and just make regc
have type WinRegistryConfiguration
. But that is not possible because of the protected destructor.
I realize it is possible to use Poco::AutoPtr
instead , but then resource is wasted by doing a dynamic allocation with new
when automatic allocation should work fine.
My question is: what is the rationale for this and am I overlooking anything?