Skip to content

Instantly share code, notes, and snippets.

@xadh00m
Created June 30, 2012 13:51
Show Gist options
  • Save xadh00m/3023828 to your computer and use it in GitHub Desktop.
Save xadh00m/3023828 to your computer and use it in GitHub Desktop.
// Type definition for a list of boost::any instances.
typedef std::vector DependencyList;
// Stores all dependencies
template struct DependencyDeleter
{
// Constructor is initialized with the list of dependencies
DependencyDeleter(DependencyList dependencies) : mDependencies(dependencies)
{}
// Is called on last SharedPtr destruction
void operator()(T* ptr)
{
// delete our pointer first
delete ptr;
// delete the dependencies now
while(mDependencies.size())
mDependencies.pop_back();
}
// holds all dependencies
DependencyList mDependencies;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment