Ardour
9.0-pre0-350-gf17a656217
TypeTraits.h
Go to the documentation of this file.
1
//------------------------------------------------------------------------------
2
/*
3
https://github.com/vinniefalco/LuaBridge
4
5
Copyright 2012, Vinnie Falco <vinnie.falco@gmail.com>
6
7
License: The MIT License (http://www.opensource.org/licenses/mit-license.php)
8
9
Permission is hereby granted, free of charge, to any person obtaining a copy
10
of this software and associated documentation files (the "Software"), to deal
11
in the Software without restriction, including without limitation the rights
12
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
copies of the Software, and to permit persons to whom the Software is
14
furnished to do so, subject to the following conditions:
15
16
The above copyright notice and this permission notice shall be included in all
17
copies or substantial portions of the Software.
18
19
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
SOFTWARE.
26
*/
27
//==============================================================================
28
29
#ifndef LUABRIDGE_TYPEINFO_HEADER
30
#define LUABRIDGE_TYPEINFO_HEADER
31
32
//------------------------------------------------------------------------------
56
template
<
class
T>
57
struct
ContainerTraits
58
{
59
typedef
bool
isNotContainer
;
60
};
61
62
//------------------------------------------------------------------------------
68
struct
TypeTraits
69
{
75
template
<
typename
T>
76
class
isContainer
77
{
78
private
:
79
typedef
char
yes
[1];
// sizeof (yes) == 1
80
typedef
char
no
[2];
// sizeof (no) == 2
81
82
template
<
typename
C>
83
static
no
&
test
(
typename
C::isNotContainer*);
84
85
template
<
typename
>
86
static
yes
&
test
(...);
87
88
public
:
89
static
const
bool
value
=
sizeof
(test <ContainerTraits <T> >(0)) ==
sizeof
(
yes
);
90
};
91
92
96
template
<
class
T>
97
struct
isConst
98
{
99
static
bool
const
value
=
false
;
100
};
101
102
template
<
class
T>
103
struct
isConst
<T const>
104
{
105
static
bool
const
value
=
true
;
106
};
112
template
<
class
T>
113
struct
removeConst
114
{
115
typedef
T
Type
;
116
};
117
118
template
<
class
T>
119
struct
removeConst
<T const>
120
{
121
typedef
T
Type
;
122
};
124
};
125
126
#endif
TypeTraits::isContainer
Definition:
TypeTraits.h:77
TypeTraits::isContainer::value
static const bool value
Definition:
TypeTraits.h:89
TypeTraits::isContainer::no
char no[2]
Definition:
TypeTraits.h:80
TypeTraits::isContainer::test
static yes & test(...)
TypeTraits::isContainer::test
static no & test(typename C::isNotContainer *)
TypeTraits::isContainer::yes
char yes[1]
Definition:
TypeTraits.h:79
ContainerTraits
Definition:
TypeTraits.h:58
ContainerTraits::isNotContainer
bool isNotContainer
Definition:
TypeTraits.h:59
TypeTraits::isConst
Definition:
TypeTraits.h:98
TypeTraits::isConst::value
static bool const value
Definition:
TypeTraits.h:99
TypeTraits::removeConst< T const >::Type
T Type
Definition:
TypeTraits.h:121
TypeTraits::removeConst
Definition:
TypeTraits.h:114
TypeTraits::removeConst::Type
T Type
Definition:
TypeTraits.h:115
TypeTraits
Definition:
TypeTraits.h:69
libs
lua
LuaBridge
detail
TypeTraits.h
Generated on Tue Nov 5 2024 05:28:51 for Ardour by
1.9.1