1.14.0.5
Hummingbird
A modern user interface library for games
SharedPointer.h
1 /*
2 This file is part of Hummingbird, a modern user interface library.
3 
4 Copyright (c) 2012-2018 Coherent Labs AD and/or its licensors. All
5 rights reserved in all media.
6 
7 The coded instructions, statements, computer programs, and/or related
8 material (collectively the "Data") in these files contain confidential
9 and unpublished information proprietary Coherent Labs and/or its
10 licensors, which is protected by United States of America federal
11 copyright law and by international treaties.
12 
13 This software or source code is supplied under the terms of a license
14 agreement and nondisclosure agreement with Coherent Labs AD and may
15 not be copied, disclosed, or exploited except in accordance with the
16 terms of that agreement. The Data may not be disclosed or distributed to
17 third parties, in whole or in part, without the prior written consent of
18 Coherent Labs AD.
19 
20 COHERENT LABS MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS
21 SOURCE CODE FOR ANY PURPOSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
22 HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
23 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE
25 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER, ITS AFFILIATES,
26 PARENT COMPANIES, LICENSORS, SUPPLIERS, OR CONTRIBUTORS BE LIABLE FOR
27 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 ANY WAY OUT OF THE USE OR PERFORMANCE OF THIS SOFTWARE OR SOURCE CODE,
33 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35 #pragma once
36 
37 #include <memory>
38 
39 namespace cohtml
40 {
41 
42 template <typename T>
43 struct PointerTrait<std::shared_ptr<T>> : TrueType
44 {
45  typedef T StoredType;
46  static void* Deref(std::shared_ptr<StoredType>& shared)
47  {
48  return shared.get();
49  }
50 };
51 
52 template <typename T>
53 struct PointerTrait<std::shared_ptr<const T>> : TrueType
54 {
55  typedef T StoredType;
56  static void* Deref(std::shared_ptr<const StoredType>& shared)
57  {
58  return const_cast<StoredType*>(shared.get());
59  }
60 };
61 
62 }
Contains almost all Coherent namespaces, classes and functions.
Definition: DataStorage.h:38