OpenShot Library | OpenShotAudio
0.2.2
juce_ContainerDeletePolicy.h
1
2
/** @weakgroup juce_core-memory
3
* @{
4
*/
5
/*
6
==============================================================================
7
8
This file is part of the JUCE library.
9
Copyright (c) 2017 - ROLI Ltd.
10
11
JUCE is an open source library subject to commercial or open-source
12
licensing.
13
14
The code included in this file is provided under the terms of the ISC license
15
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
16
To use, copy, modify, and/or distribute this software for any purpose with or
17
without fee is hereby granted provided that the above copyright notice and
18
this permission notice appear in all copies.
19
20
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
21
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
22
DISCLAIMED.
23
24
==============================================================================
25
*/
26
27
namespace
juce
28
{
29
30
//==============================================================================
31
/**
32
Used by container classes as an indirect way to delete an object of a
33
particular type.
34
35
The generic implementation of this class simply calls 'delete', but you can
36
create a specialised version of it for a particular class if you need to
37
delete that type of object in a more appropriate way.
38
39
@see OwnedArray
40
41
@tags{Core}
42
*/
43
template
<
typename
ObjectType>
44
struct
ContainerDeletePolicy
45
{
46
static
void
destroy (ObjectType*
object
)
47
{
48
// If the line below triggers a compiler error, it means that you are using
49
// an incomplete type for ObjectType (for example, a type that is declared
50
// but not defined). This is a problem because then the following delete is
51
// undefined behaviour. The purpose of the sizeof is to capture this situation.
52
// If this was caused by a OwnedArray of a forward-declared type, move the
53
// implementation of all methods trying to use the OwnedArray (e.g. the destructor
54
// of the class owning it) into cpp files where they can see to the definition
55
// of ObjectType. This should fix the error.
56
ignoreUnused (
sizeof
(ObjectType));
57
58
delete
object;
59
}
60
};
61
62
}
// namespace juce
63
64
/** @}*/
juce
Definition:
juce_AudioPlayHead.h:27
juce::ContainerDeletePolicy
Used by container classes as an indirect way to delete an object of a particular type.
Definition:
juce_ContainerDeletePolicy.h:44
juce_core
memory
juce_ContainerDeletePolicy.h
Generated on Sun Mar 6 2022 19:35:30 for OpenShot Library | OpenShotAudio by
1.8.13