2018-08-06 22:36:12 +08:00
|
|
|
/*
|
2019-01-29 21:57:59 +08:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2018-08-06 22:36:12 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-08-06 22:36:12 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
namespace OCLRT {
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
using ReleaseableObjectPtr = std::unique_ptr<T, void (*)(T *)>;
|
|
|
|
|
|
|
|
template <typename T>
|
2019-01-29 21:57:59 +08:00
|
|
|
static ReleaseableObjectPtr<T> clUniquePtr(T *object) {
|
2018-08-06 22:36:12 +08:00
|
|
|
return ReleaseableObjectPtr<T>{object, [](T *p) { p->release(); }};
|
|
|
|
}
|
|
|
|
} // namespace OCLRT
|