openshot-audio  0.1.2
juce_ContainerDeletePolicy.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the juce_core module of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission to use, copy, modify, and/or distribute this software for any purpose with
8  or without fee is hereby granted, provided that the above copyright notice and this
9  permission notice appear in all copies.
10 
11  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
12  TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
13  NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
15  IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 
18  ------------------------------------------------------------------------------
19 
20  NOTE! This permissive ISC license applies ONLY to files within the juce_core module!
21  All other JUCE modules are covered by a dual GPL/commercial license, so if you are
22  using any other modules, be sure to check that you also comply with their license.
23 
24  For more details, visit www.juce.com
25 
26  ==============================================================================
27 */
28 
29 #ifndef JUCE_CONTAINERDELETEPOLICY_H_INCLUDED
30 #define JUCE_CONTAINERDELETEPOLICY_H_INCLUDED
31 
32 //==============================================================================
43 template <typename ObjectType>
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 ScopedPointer to a forward-declared type, move the
53  // implementation of all methods trying to use the ScopedPointer (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 
63 #endif // JUCE_CONTAINERDELETEPOLICY_H_INCLUDED
void ignoreUnused(const Type1 &) noexcept
Definition: juce_core.h:280
Definition: juce_ContainerDeletePolicy.h:44
void * object
Definition: jmemsys.h:50
static void destroy(ObjectType *object)
Definition: juce_ContainerDeletePolicy.h:46