Created
June 30, 2012 13:51
-
-
Save xadh00m/3023828 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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