Ardour
8.12
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
93
template
<
typename
T>
94
class
isEnum
95
{
96
public
:
97
//static const bool value = std::is_enum<T>::value; // C++11
98
static
const
bool
value
= boost::is_enum<T>::value;
99
};
100
101
105
template
<
class
T>
106
struct
isConst
107
{
108
static
bool
const
value
=
false
;
109
};
110
111
template
<
class
T>
112
struct
isConst
<T const>
113
{
114
static
bool
const
value
=
true
;
115
};
121
template
<
class
T>
122
struct
removeConst
123
{
124
typedef
T
Type
;
125
};
126
127
template
<
class
T>
128
struct
removeConst
<T const>
129
{
130
typedef
T
Type
;
131
};
133
};
134
135
#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
TypeTraits::isEnum
Definition:
TypeTraits.h:95
TypeTraits::isEnum::value
static const bool value
Definition:
TypeTraits.h:98
ContainerTraits
Definition:
TypeTraits.h:58
ContainerTraits::isNotContainer
bool isNotContainer
Definition:
TypeTraits.h:59
TypeTraits::isConst
Definition:
TypeTraits.h:107
TypeTraits::isConst::value
static bool const value
Definition:
TypeTraits.h:108
TypeTraits::removeConst< T const >::Type
T Type
Definition:
TypeTraits.h:130
TypeTraits::removeConst
Definition:
TypeTraits.h:123
TypeTraits::removeConst::Type
T Type
Definition:
TypeTraits.h:124
TypeTraits
Definition:
TypeTraits.h:69
libs
lua
LuaBridge
detail
TypeTraits.h
Generated on Mon Mar 10 2025 20:26:30 for Ardour by
1.9.1