Audacity
3.2.0
libraries
lib-utility
CFResources.h
Go to the documentation of this file.
1
/*!********************************************************************
2
3
Audacity: A Digital Audio Editor
4
5
@file CFResources.h
6
7
@brief Wrap resource pointers from Apple Core SDK for RAII
8
9
Paul Licameli
10
11
**********************************************************************/
12
13
#ifndef __AUDACITY_CFRESOURCES__
14
#define __AUDACITY_CFRESOURCES__
15
16
#ifdef __APPLE__
17
18
#include <cstddef>
19
#include <memory>
20
#include <type_traits>
21
#include <utility>
22
#include <CoreFoundation/CFBase.h>
23
24
template
<
typename
T =
void
*>
struct
CFReleaser{
25
void
operator () (T p)
const
noexcept
{
if
(p) CFRelease(p); } };
26
28
40
template
<
typename
T>
using
CF_ptr =
41
std::unique_ptr<std::remove_pointer_t<T>, CFReleaser<T>>;
42
43
extern
template
struct
CFReleaser<>;
44
45
#endif
46
#endif
Generated by
1.9.3