implement singleton lazy initialization

This commit is contained in:
Alexander Alekhin
2015-06-23 14:31:01 +03:00
parent 945aa06f58
commit 53fc5440d7
6 changed files with 72 additions and 61 deletions

View File

@@ -222,14 +222,9 @@ public:
}
};
static StdMatAllocator *mat_allocator = NULL;
MatAllocator* Mat::getStdAllocator()
{
if (mat_allocator == NULL)
{
mat_allocator = new StdMatAllocator();
}
return mat_allocator;
CV_SINGLETON_LAZY_INIT(MatAllocator, new StdMatAllocator())
}
void swap( Mat& a, Mat& b )