mirror of
https://gitlab.com/fbb-git/cppannotations
synced 2024-11-18 10:06:54 +01:00
2b428db412
git-svn-id: https://cppannotations.svn.sourceforge.net/svnroot/cppannotations/trunk@358 f6dd340e-d3f9-0310-b409-bdd246841980
20 lines
464 B
C++
20 lines
464 B
C++
#include <iostream>
|
|
#include <memory>
|
|
using namespace std;
|
|
|
|
template <typename Type, size_t size>
|
|
struct Deleter
|
|
{
|
|
void operator()(Type * ptr) const
|
|
{
|
|
for (size_t idx = 0; idx < size; ++idx)
|
|
delete ptr[idx];
|
|
delete ptr;
|
|
}
|
|
};
|
|
int main()
|
|
{
|
|
unique_ptr<int *, Deleter<int *, 10>> sp2(new int *[10]);
|
|
|
|
Deleter<int *, 10> &obj = sp2.get_deleter();
|
|
}
|