I need to create a set of shells C++around an existing library C.
For many library objects, the Cconstruction is done by calling something like britney_spears* create_britney_spears()and the opposite function void free_britney_spears(britney_spears* brit).
If the distribution britney_spearsfails, create_britney_spears()returns NULL.
This, as far as I know, is a very common picture.
Now I want to wrap this inside a class C++.
class BritneySpears
{
public:
BritneySpears();
private:
boost::shared_ptr<britney_spears> m_britney_spears;
};
And here is the implementation:
BritneySpears::BritneySpears() :
m_britney_spears(create_britney_spears(), free_britney_spears)
{
if (!m_britney_spears)
{
}
}
So, the question is in the code example: What needs to be done to interrupt the constructor?
, , , . , . ? std ?
.