Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
c1fc27e2
Commit
c1fc27e2
authored
Sep 13, 2016
by
Wenzel Jakob
Browse files
use detail::enable_if_t everywhere
parent
8e5dceb6
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
63 additions
and
63 deletions
+63
-63
include/pybind11/attr.h
include/pybind11/attr.h
+5
-5
include/pybind11/cast.h
include/pybind11/cast.h
+19
-19
include/pybind11/common.h
include/pybind11/common.h
+2
-2
include/pybind11/descr.h
include/pybind11/descr.h
+4
-4
include/pybind11/eigen.h
include/pybind11/eigen.h
+10
-10
include/pybind11/numpy.h
include/pybind11/numpy.h
+8
-8
include/pybind11/pybind11.h
include/pybind11/pybind11.h
+5
-5
include/pybind11/pytypes.h
include/pybind11/pytypes.h
+2
-2
include/pybind11/stl.h
include/pybind11/stl.h
+1
-1
include/pybind11/stl_bind.h
include/pybind11/stl_bind.h
+7
-7
No files found.
include/pybind11/attr.h
View file @
c1fc27e2
...
@@ -276,7 +276,7 @@ template <> struct process_attribute<arg_v> : process_attribute_default<arg_v> {
...
@@ -276,7 +276,7 @@ template <> struct process_attribute<arg_v> : process_attribute_default<arg_v> {
/// Process a parent class attribute
/// Process a parent class attribute
template
<
typename
T
>
template
<
typename
T
>
struct
process_attribute
<
T
,
typename
std
::
enable_if
<
std
::
is_base_of
<
handle
,
T
>::
value
>
::
type
>
:
process_attribute_default
<
handle
>
{
struct
process_attribute
<
T
,
enable_if
_t
<
std
::
is_base_of
<
handle
,
T
>::
value
>>
:
process_attribute_default
<
handle
>
{
static
void
init
(
const
handle
&
h
,
type_record
*
r
)
{
r
->
bases
.
append
(
h
);
}
static
void
init
(
const
handle
&
h
,
type_record
*
r
)
{
r
->
bases
.
append
(
h
);
}
};
};
...
@@ -298,13 +298,13 @@ struct process_attribute<multiple_inheritance> : process_attribute_default<multi
...
@@ -298,13 +298,13 @@ struct process_attribute<multiple_inheritance> : process_attribute_default<multi
* otherwise
* otherwise
*/
*/
template
<
int
Nurse
,
int
Patient
>
struct
process_attribute
<
keep_alive
<
Nurse
,
Patient
>>
:
public
process_attribute_default
<
keep_alive
<
Nurse
,
Patient
>>
{
template
<
int
Nurse
,
int
Patient
>
struct
process_attribute
<
keep_alive
<
Nurse
,
Patient
>>
:
public
process_attribute_default
<
keep_alive
<
Nurse
,
Patient
>>
{
template
<
int
N
=
Nurse
,
int
P
=
Patient
,
typename
std
::
enable_if
<
N
!=
0
&&
P
!=
0
,
int
>
::
type
=
0
>
template
<
int
N
=
Nurse
,
int
P
=
Patient
,
enable_if
_t
<
N
!=
0
&&
P
!=
0
,
int
>
=
0
>
static
void
precall
(
handle
args
)
{
keep_alive_impl
(
Nurse
,
Patient
,
args
,
handle
());
}
static
void
precall
(
handle
args
)
{
keep_alive_impl
(
Nurse
,
Patient
,
args
,
handle
());
}
template
<
int
N
=
Nurse
,
int
P
=
Patient
,
typename
std
::
enable_if
<
N
!=
0
&&
P
!=
0
,
int
>
::
type
=
0
>
template
<
int
N
=
Nurse
,
int
P
=
Patient
,
enable_if
_t
<
N
!=
0
&&
P
!=
0
,
int
>
=
0
>
static
void
postcall
(
handle
,
handle
)
{
}
static
void
postcall
(
handle
,
handle
)
{
}
template
<
int
N
=
Nurse
,
int
P
=
Patient
,
typename
std
::
enable_if
<
N
==
0
||
P
==
0
,
int
>
::
type
=
0
>
template
<
int
N
=
Nurse
,
int
P
=
Patient
,
enable_if
_t
<
N
==
0
||
P
==
0
,
int
>
=
0
>
static
void
precall
(
handle
)
{
}
static
void
precall
(
handle
)
{
}
template
<
int
N
=
Nurse
,
int
P
=
Patient
,
typename
std
::
enable_if
<
N
==
0
||
P
==
0
,
int
>
::
type
=
0
>
template
<
int
N
=
Nurse
,
int
P
=
Patient
,
enable_if
_t
<
N
==
0
||
P
==
0
,
int
>
=
0
>
static
void
postcall
(
handle
args
,
handle
ret
)
{
keep_alive_impl
(
Nurse
,
Patient
,
args
,
ret
);
}
static
void
postcall
(
handle
args
,
handle
ret
)
{
keep_alive_impl
(
Nurse
,
Patient
,
args
,
ret
);
}
};
};
...
...
include/pybind11/cast.h
View file @
c1fc27e2
...
@@ -343,10 +343,10 @@ protected:
...
@@ -343,10 +343,10 @@ protected:
#else
#else
/* Visual Studio 2015's SFINAE implementation doesn't yet handle the above robustly in all situations.
/* Visual Studio 2015's SFINAE implementation doesn't yet handle the above robustly in all situations.
Use a workaround that only tests for constructibility for now. */
Use a workaround that only tests for constructibility for now. */
template
<
typename
T
=
type
,
typename
=
typename
std
::
enable_if
<
std
::
is_copy_constructible
<
T
>
::
value
>
::
type
>
template
<
typename
T
=
type
,
typename
=
enable_if
_t
<
std
::
is_copy_constructible
<
T
>
::
value
>>
static
Constructor
make_copy_constructor
(
const
T
*
value
)
{
static
Constructor
make_copy_constructor
(
const
T
*
value
)
{
return
[](
const
void
*
arg
)
->
void
*
{
return
new
T
(
*
((
const
T
*
)
arg
));
};
}
return
[](
const
void
*
arg
)
->
void
*
{
return
new
T
(
*
((
const
T
*
)
arg
));
};
}
template
<
typename
T
=
type
,
typename
=
typename
std
::
enable_if
<
std
::
is_move_constructible
<
T
>
::
value
>
::
type
>
template
<
typename
T
=
type
,
typename
=
enable_if
_t
<
std
::
is_move_constructible
<
T
>
::
value
>>
static
Constructor
make_move_constructor
(
const
T
*
value
)
{
static
Constructor
make_move_constructor
(
const
T
*
value
)
{
return
[](
const
void
*
arg
)
->
void
*
{
return
(
void
*
)
new
T
(
std
::
move
(
*
((
T
*
)
arg
)));
};
}
return
[](
const
void
*
arg
)
->
void
*
{
return
(
void
*
)
new
T
(
std
::
move
(
*
((
T
*
)
arg
)));
};
}
#endif
#endif
...
@@ -387,8 +387,8 @@ public:
...
@@ -387,8 +387,8 @@ public:
template
<
typename
T
>
template
<
typename
T
>
struct
type_caster
<
struct
type_caster
<
T
,
typename
std
::
enable_if
<
std
::
is_integral
<
T
>::
value
||
T
,
enable_if
_t
<
std
::
is_integral
<
T
>::
value
||
std
::
is_floating_point
<
T
>::
value
>
::
type
>
{
std
::
is_floating_point
<
T
>::
value
>>
{
typedef
typename
std
::
conditional
<
sizeof
(
T
)
<=
sizeof
(
long
),
long
,
long
long
>::
type
_py_type_0
;
typedef
typename
std
::
conditional
<
sizeof
(
T
)
<=
sizeof
(
long
),
long
,
long
long
>::
type
_py_type_0
;
typedef
typename
std
::
conditional
<
std
::
is_signed
<
T
>::
value
,
_py_type_0
,
typename
std
::
make_unsigned
<
_py_type_0
>::
type
>::
type
_py_type_1
;
typedef
typename
std
::
conditional
<
std
::
is_signed
<
T
>::
value
,
_py_type_0
,
typename
std
::
make_unsigned
<
_py_type_0
>::
type
>::
type
_py_type_1
;
typedef
typename
std
::
conditional
<
std
::
is_floating_point
<
T
>::
value
,
double
,
_py_type_1
>::
type
py_type
;
typedef
typename
std
::
conditional
<
std
::
is_floating_point
<
T
>::
value
,
double
,
_py_type_1
>::
type
py_type
;
...
@@ -702,20 +702,20 @@ public:
...
@@ -702,20 +702,20 @@ public:
return
load
(
src
,
convert
,
typename
make_index_sequence
<
sizeof
...(
Tuple
)
>::
type
());
return
load
(
src
,
convert
,
typename
make_index_sequence
<
sizeof
...(
Tuple
)
>::
type
());
}
}
template
<
typename
T
=
itype
,
typename
std
::
enable_if
<
template
<
typename
T
=
itype
,
enable_if
_t
<
!
std
::
is_same
<
T
,
args_type
>
::
value
&&
!
std
::
is_same
<
T
,
args_type
>
::
value
&&
!
std
::
is_same
<
T
,
args_kwargs_type
>::
value
,
int
>
::
type
=
0
>
!
std
::
is_same
<
T
,
args_kwargs_type
>::
value
,
int
>
=
0
>
bool
load_args
(
handle
args
,
handle
,
bool
convert
)
{
bool
load_args
(
handle
args
,
handle
,
bool
convert
)
{
return
load
(
args
,
convert
,
typename
make_index_sequence
<
sizeof
...(
Tuple
)
>::
type
());
return
load
(
args
,
convert
,
typename
make_index_sequence
<
sizeof
...(
Tuple
)
>::
type
());
}
}
template
<
typename
T
=
itype
,
typename
std
::
enable_if
<
std
::
is_same
<
T
,
args_type
>
::
value
,
int
>
::
type
=
0
>
template
<
typename
T
=
itype
,
enable_if
_t
<
std
::
is_same
<
T
,
args_type
>
::
value
,
int
>
=
0
>
bool
load_args
(
handle
args
,
handle
,
bool
convert
)
{
bool
load_args
(
handle
args
,
handle
,
bool
convert
)
{
std
::
get
<
0
>
(
value
).
load
(
args
,
convert
);
std
::
get
<
0
>
(
value
).
load
(
args
,
convert
);
return
true
;
return
true
;
}
}
template
<
typename
T
=
itype
,
typename
std
::
enable_if
<
std
::
is_same
<
T
,
args_kwargs_type
>
::
value
,
int
>
::
type
=
0
>
template
<
typename
T
=
itype
,
enable_if
_t
<
std
::
is_same
<
T
,
args_kwargs_type
>
::
value
,
int
>
=
0
>
bool
load_args
(
handle
args
,
handle
kwargs
,
bool
convert
)
{
bool
load_args
(
handle
args
,
handle
kwargs
,
bool
convert
)
{
std
::
get
<
0
>
(
value
).
load
(
args
,
convert
);
std
::
get
<
0
>
(
value
).
load
(
args
,
convert
);
std
::
get
<
1
>
(
value
).
load
(
kwargs
,
convert
);
std
::
get
<
1
>
(
value
).
load
(
kwargs
,
convert
);
...
@@ -734,11 +734,11 @@ public:
...
@@ -734,11 +734,11 @@ public:
return
type_descr
(
_
(
"Tuple["
)
+
element_names
()
+
_
(
"]"
));
return
type_descr
(
_
(
"Tuple["
)
+
element_names
()
+
_
(
"]"
));
}
}
template
<
typename
ReturnValue
,
typename
Func
>
typename
std
::
enable_if
<!
std
::
is_void
<
ReturnValue
>::
value
,
ReturnValue
>
::
type
call
(
Func
&&
f
)
{
template
<
typename
ReturnValue
,
typename
Func
>
enable_if
_t
<!
std
::
is_void
<
ReturnValue
>::
value
,
ReturnValue
>
call
(
Func
&&
f
)
{
return
call
<
ReturnValue
>
(
std
::
forward
<
Func
>
(
f
),
typename
make_index_sequence
<
sizeof
...(
Tuple
)
>::
type
());
return
call
<
ReturnValue
>
(
std
::
forward
<
Func
>
(
f
),
typename
make_index_sequence
<
sizeof
...(
Tuple
)
>::
type
());
}
}
template
<
typename
ReturnValue
,
typename
Func
>
typename
std
::
enable_if
<
std
::
is_void
<
ReturnValue
>::
value
,
void_type
>
::
type
call
(
Func
&&
f
)
{
template
<
typename
ReturnValue
,
typename
Func
>
enable_if
_t
<
std
::
is_void
<
ReturnValue
>::
value
,
void_type
>
call
(
Func
&&
f
)
{
call
<
ReturnValue
>
(
std
::
forward
<
Func
>
(
f
),
typename
make_index_sequence
<
sizeof
...(
Tuple
)
>::
type
());
call
<
ReturnValue
>
(
std
::
forward
<
Func
>
(
f
),
typename
make_index_sequence
<
sizeof
...(
Tuple
)
>::
type
());
return
void_type
();
return
void_type
();
}
}
...
@@ -908,12 +908,12 @@ template <> struct handle_type_name<args> { static PYBIND11_DESCR name() { retur
...
@@ -908,12 +908,12 @@ template <> struct handle_type_name<args> { static PYBIND11_DESCR name() { retur
template
<
>
struct
handle_type_name
<
kwargs
>
{
static
PYBIND11_DESCR
name
()
{
return
_
(
"**kwargs"
);
}
};
template
<
>
struct
handle_type_name
<
kwargs
>
{
static
PYBIND11_DESCR
name
()
{
return
_
(
"**kwargs"
);
}
};
template
<
typename
type
>
template
<
typename
type
>
struct
type_caster
<
type
,
typename
std
::
enable_if
<
std
::
is_base_of
<
handle
,
type
>::
value
>
::
type
>
{
struct
type_caster
<
type
,
enable_if
_t
<
std
::
is_base_of
<
handle
,
type
>::
value
>>
{
public:
public:
template
<
typename
T
=
type
,
typename
std
::
enable_if
<!
std
::
is_base_of
<
object
,
T
>
::
value
,
int
>
::
type
=
0
>
template
<
typename
T
=
type
,
enable_if
_t
<!
std
::
is_base_of
<
object
,
T
>
::
value
,
int
>
=
0
>
bool
load
(
handle
src
,
bool
/* convert */
)
{
value
=
type
(
src
);
return
value
.
check
();
}
bool
load
(
handle
src
,
bool
/* convert */
)
{
value
=
type
(
src
);
return
value
.
check
();
}
template
<
typename
T
=
type
,
typename
std
::
enable_if
<
std
::
is_base_of
<
object
,
T
>
::
value
,
int
>
::
type
=
0
>
template
<
typename
T
=
type
,
enable_if
_t
<
std
::
is_base_of
<
object
,
T
>
::
value
,
int
>
=
0
>
bool
load
(
handle
src
,
bool
/* convert */
)
{
value
=
type
(
src
,
true
);
return
value
.
check
();
}
bool
load
(
handle
src
,
bool
/* convert */
)
{
value
=
type
(
src
,
true
);
return
value
.
check
();
}
static
handle
cast
(
const
handle
&
src
,
return_value_policy
/* policy */
,
handle
/* parent */
)
{
static
handle
cast
(
const
handle
&
src
,
return_value_policy
/* policy */
,
handle
/* parent */
)
{
...
@@ -932,21 +932,21 @@ public:
...
@@ -932,21 +932,21 @@ public:
// must have ref_count() == 1)h
// must have ref_count() == 1)h
// If any of the above are not satisfied, we fall back to copying.
// If any of the above are not satisfied, we fall back to copying.
template
<
typename
T
,
typename
SFINAE
=
void
>
struct
move_is_plain_type
:
std
::
false_type
{};
template
<
typename
T
,
typename
SFINAE
=
void
>
struct
move_is_plain_type
:
std
::
false_type
{};
template
<
typename
T
>
struct
move_is_plain_type
<
T
,
typename
std
::
enable_if
<
template
<
typename
T
>
struct
move_is_plain_type
<
T
,
enable_if
_t
<
!
std
::
is_void
<
T
>::
value
&&
!
std
::
is_pointer
<
T
>::
value
&&
!
std
::
is_reference
<
T
>::
value
&&
!
std
::
is_const
<
T
>::
value
!
std
::
is_void
<
T
>::
value
&&
!
std
::
is_pointer
<
T
>::
value
&&
!
std
::
is_reference
<
T
>::
value
&&
!
std
::
is_const
<
T
>::
value
>
::
type
>
:
std
::
true_type
{};
>>
:
std
::
true_type
{
};
template
<
typename
T
,
typename
SFINAE
=
void
>
struct
move_always
:
std
::
false_type
{};
template
<
typename
T
,
typename
SFINAE
=
void
>
struct
move_always
:
std
::
false_type
{};
template
<
typename
T
>
struct
move_always
<
T
,
typename
std
::
enable_if
<
template
<
typename
T
>
struct
move_always
<
T
,
enable_if
_t
<
move_is_plain_type
<
T
>::
value
&&
move_is_plain_type
<
T
>::
value
&&
!
std
::
is_copy_constructible
<
T
>::
value
&&
std
::
is_move_constructible
<
T
>::
value
&&
!
std
::
is_copy_constructible
<
T
>::
value
&&
std
::
is_move_constructible
<
T
>::
value
&&
std
::
is_same
<
decltype
(
std
::
declval
<
type_caster
<
T
>>
().
operator
T
&
()),
T
&>::
value
std
::
is_same
<
decltype
(
std
::
declval
<
type_caster
<
T
>>
().
operator
T
&
()),
T
&>::
value
>
::
type
>
:
std
::
true_type
{};
>>
:
std
::
true_type
{
};
template
<
typename
T
,
typename
SFINAE
=
void
>
struct
move_if_unreferenced
:
std
::
false_type
{};
template
<
typename
T
,
typename
SFINAE
=
void
>
struct
move_if_unreferenced
:
std
::
false_type
{};
template
<
typename
T
>
struct
move_if_unreferenced
<
T
,
typename
std
::
enable_if
<
template
<
typename
T
>
struct
move_if_unreferenced
<
T
,
enable_if
_t
<
move_is_plain_type
<
T
>::
value
&&
move_is_plain_type
<
T
>::
value
&&
!
move_always
<
T
>::
value
&&
std
::
is_move_constructible
<
T
>::
value
&&
!
move_always
<
T
>::
value
&&
std
::
is_move_constructible
<
T
>::
value
&&
std
::
is_same
<
decltype
(
std
::
declval
<
type_caster
<
T
>>
().
operator
T
&
()),
T
&>::
value
std
::
is_same
<
decltype
(
std
::
declval
<
type_caster
<
T
>>
().
operator
T
&
()),
T
&>::
value
>
::
type
>
:
std
::
true_type
{};
>>
:
std
::
true_type
{
};
template
<
typename
T
>
using
move_never
=
std
::
integral_constant
<
bool
,
!
move_always
<
T
>::
value
&&
!
move_if_unreferenced
<
T
>::
value
>
;
template
<
typename
T
>
using
move_never
=
std
::
integral_constant
<
bool
,
!
move_always
<
T
>::
value
&&
!
move_if_unreferenced
<
T
>::
value
>
;
// Detect whether returning a `type` from a cast on type's type_caster is going to result in a
// Detect whether returning a `type` from a cast on type's type_caster is going to result in a
...
...
include/pybind11/common.h
View file @
c1fc27e2
...
@@ -442,14 +442,14 @@ PYBIND11_RUNTIME_EXCEPTION(reference_cast_error, PyExc_RuntimeError) /// Used in
...
@@ -442,14 +442,14 @@ PYBIND11_RUNTIME_EXCEPTION(reference_cast_error, PyExc_RuntimeError) /// Used in
template
<
typename
T
,
typename
SFINAE
=
void
>
struct
format_descriptor
{
};
template
<
typename
T
,
typename
SFINAE
=
void
>
struct
format_descriptor
{
};
template
<
typename
T
>
struct
format_descriptor
<
T
,
typename
std
::
enable_if
<
std
::
is_integral
<
T
>::
value
>
::
type
>
{
template
<
typename
T
>
struct
format_descriptor
<
T
,
detail
::
enable_if
_t
<
std
::
is_integral
<
T
>::
value
>>
{
static
constexpr
const
char
value
[
2
]
=
static
constexpr
const
char
value
[
2
]
=
{
"bBhHiIqQ"
[
detail
::
log2
(
sizeof
(
T
))
*
2
+
(
std
::
is_unsigned
<
T
>::
value
?
1
:
0
)],
'\0'
};
{
"bBhHiIqQ"
[
detail
::
log2
(
sizeof
(
T
))
*
2
+
(
std
::
is_unsigned
<
T
>::
value
?
1
:
0
)],
'\0'
};
static
std
::
string
format
()
{
return
value
;
}
static
std
::
string
format
()
{
return
value
;
}
};
};
template
<
typename
T
>
constexpr
const
char
format_descriptor
<
template
<
typename
T
>
constexpr
const
char
format_descriptor
<
T
,
typename
std
::
enable_if
<
std
::
is_integral
<
T
>::
value
>
::
type
>::
value
[
2
];
T
,
detail
::
enable_if
_t
<
std
::
is_integral
<
T
>::
value
>>::
value
[
2
];
/// RAII wrapper that temporarily clears any Python error state
/// RAII wrapper that temporarily clears any Python error state
struct
error_scope
{
struct
error_scope
{
...
...
include/pybind11/descr.h
View file @
c1fc27e2
...
@@ -86,11 +86,11 @@ template <size_t...Digits> struct int_to_str<0, Digits...> {
...
@@ -86,11 +86,11 @@ template <size_t...Digits> struct int_to_str<0, Digits...> {
// Ternary description (like std::conditional)
// Ternary description (like std::conditional)
template
<
bool
B
,
size_t
Size1
,
size_t
Size2
>
template
<
bool
B
,
size_t
Size1
,
size_t
Size2
>
constexpr
typename
std
::
enable_if
<
B
,
descr
<
Size1
-
1
,
0
>>
::
type
_
(
char
const
(
&
text1
)[
Size1
],
char
const
(
&
)[
Size2
])
{
constexpr
enable_if
_t
<
B
,
descr
<
Size1
-
1
,
0
>>
_
(
char
const
(
&
text1
)[
Size1
],
char
const
(
&
)[
Size2
])
{
return
_
(
text1
);
return
_
(
text1
);
}
}
template
<
bool
B
,
size_t
Size1
,
size_t
Size2
>
template
<
bool
B
,
size_t
Size1
,
size_t
Size2
>
constexpr
typename
std
::
enable_if
<!
B
,
descr
<
Size2
-
1
,
0
>>
::
type
_
(
char
const
(
&
)[
Size1
],
char
const
(
&
text2
)[
Size2
])
{
constexpr
enable_if
_t
<!
B
,
descr
<
Size2
-
1
,
0
>>
_
(
char
const
(
&
)[
Size1
],
char
const
(
&
text2
)[
Size2
])
{
return
_
(
text2
);
return
_
(
text2
);
}
}
...
@@ -164,8 +164,8 @@ PYBIND11_NOINLINE inline descr _(const char *text) {
...
@@ -164,8 +164,8 @@ PYBIND11_NOINLINE inline descr _(const char *text) {
return
descr
(
text
,
types
);
return
descr
(
text
,
types
);
}
}
template
<
bool
B
>
PYBIND11_NOINLINE
typename
std
::
enable_if
<
B
,
descr
>
::
type
_
(
const
char
*
text1
,
const
char
*
)
{
return
_
(
text1
);
}
template
<
bool
B
>
PYBIND11_NOINLINE
enable_if
_t
<
B
,
descr
>
_
(
const
char
*
text1
,
const
char
*
)
{
return
_
(
text1
);
}
template
<
bool
B
>
PYBIND11_NOINLINE
typename
std
::
enable_if
<!
B
,
descr
>
::
type
_
(
char
const
*
,
const
char
*
text2
)
{
return
_
(
text2
);
}
template
<
bool
B
>
PYBIND11_NOINLINE
enable_if
_t
<!
B
,
descr
>
_
(
char
const
*
,
const
char
*
text2
)
{
return
_
(
text2
);
}
template
<
typename
Type
>
PYBIND11_NOINLINE
descr
_
()
{
template
<
typename
Type
>
PYBIND11_NOINLINE
descr
_
()
{
const
std
::
type_info
*
types
[
2
]
=
{
&
typeid
(
Type
),
nullptr
};
const
std
::
type_info
*
types
[
2
]
=
{
&
typeid
(
Type
),
nullptr
};
...
...
include/pybind11/eigen.h
View file @
c1fc27e2
...
@@ -46,9 +46,9 @@ public:
...
@@ -46,9 +46,9 @@ public:
// type_caster to handle argument copying/forwarding.
// type_caster to handle argument copying/forwarding.
template
<
typename
T
>
class
is_eigen_ref
{
template
<
typename
T
>
class
is_eigen_ref
{
private:
private:
template
<
typename
Derived
>
static
typename
std
::
enable_if
<
template
<
typename
Derived
>
static
enable_if
_t
<
std
::
is_same
<
typename
std
::
remove_const
<
T
>::
type
,
Eigen
::
Ref
<
Derived
>>::
value
,
std
::
is_same
<
typename
std
::
remove_const
<
T
>::
type
,
Eigen
::
Ref
<
Derived
>>::
value
,
Derived
>
::
type
test
(
const
Eigen
::
Ref
<
Derived
>
&
);
Derived
>
test
(
const
Eigen
::
Ref
<
Derived
>
&
);
static
void
test
(...);
static
void
test
(...);
public:
public:
typedef
decltype
(
test
(
std
::
declval
<
T
>
()))
Derived
;
typedef
decltype
(
test
(
std
::
declval
<
T
>
()))
Derived
;
...
@@ -77,7 +77,7 @@ public:
...
@@ -77,7 +77,7 @@ public:
};
};
template
<
typename
Type
>
template
<
typename
Type
>
struct
type_caster
<
Type
,
typename
std
::
enable_if
<
is_eigen_dense
<
Type
>::
value
&&
!
is_eigen_ref
<
Type
>::
value
>
::
type
>
{
struct
type_caster
<
Type
,
enable_if
_t
<
is_eigen_dense
<
Type
>::
value
&&
!
is_eigen_ref
<
Type
>::
value
>>
{
typedef
typename
Type
::
Scalar
Scalar
;
typedef
typename
Type
::
Scalar
Scalar
;
static
constexpr
bool
rowMajor
=
Type
::
Flags
&
Eigen
::
RowMajorBit
;
static
constexpr
bool
rowMajor
=
Type
::
Flags
&
Eigen
::
RowMajorBit
;
static
constexpr
bool
isVector
=
Type
::
IsVectorAtCompileTime
;
static
constexpr
bool
isVector
=
Type
::
IsVectorAtCompileTime
;
...
@@ -149,18 +149,18 @@ struct type_caster<Type, typename std::enable_if<is_eigen_dense<Type>::value &&
...
@@ -149,18 +149,18 @@ struct type_caster<Type, typename std::enable_if<is_eigen_dense<Type>::value &&
_
(
"["
)
+
rows
()
+
_
(
", "
)
+
cols
()
+
_
(
"]]"
));
_
(
"["
)
+
rows
()
+
_
(
", "
)
+
cols
()
+
_
(
"]]"
));
protected:
protected:
template
<
typename
T
=
Type
,
typename
std
::
enable_if
<
T
::
RowsAtCompileTime
==
Eigen
::
Dynamic
,
int
>
::
type
=
0
>
template
<
typename
T
=
Type
,
enable_if
_t
<
T
::
RowsAtCompileTime
==
Eigen
::
Dynamic
,
int
>
=
0
>
static
PYBIND11_DESCR
rows
()
{
return
_
(
"m"
);
}
static
PYBIND11_DESCR
rows
()
{
return
_
(
"m"
);
}
template
<
typename
T
=
Type
,
typename
std
::
enable_if
<
T
::
RowsAtCompileTime
!=
Eigen
::
Dynamic
,
int
>
::
type
=
0
>
template
<
typename
T
=
Type
,
enable_if
_t
<
T
::
RowsAtCompileTime
!=
Eigen
::
Dynamic
,
int
>
=
0
>
static
PYBIND11_DESCR
rows
()
{
return
_
<
T
::
RowsAtCompileTime
>
();
}
static
PYBIND11_DESCR
rows
()
{
return
_
<
T
::
RowsAtCompileTime
>
();
}
template
<
typename
T
=
Type
,
typename
std
::
enable_if
<
T
::
ColsAtCompileTime
==
Eigen
::
Dynamic
,
int
>
::
type
=
0
>
template
<
typename
T
=
Type
,
enable_if
_t
<
T
::
ColsAtCompileTime
==
Eigen
::
Dynamic
,
int
>
=
0
>
static
PYBIND11_DESCR
cols
()
{
return
_
(
"n"
);
}
static
PYBIND11_DESCR
cols
()
{
return
_
(
"n"
);
}
template
<
typename
T
=
Type
,
typename
std
::
enable_if
<
T
::
ColsAtCompileTime
!=
Eigen
::
Dynamic
,
int
>
::
type
=
0
>
template
<
typename
T
=
Type
,
enable_if
_t
<
T
::
ColsAtCompileTime
!=
Eigen
::
Dynamic
,
int
>
=
0
>
static
PYBIND11_DESCR
cols
()
{
return
_
<
T
::
ColsAtCompileTime
>
();
}
static
PYBIND11_DESCR
cols
()
{
return
_
<
T
::
ColsAtCompileTime
>
();
}
};
};
template
<
typename
Type
>
template
<
typename
Type
>
struct
type_caster
<
Type
,
typename
std
::
enable_if
<
is_eigen_dense
<
Type
>::
value
&&
is_eigen_ref
<
Type
>::
value
>
::
type
>
{
struct
type_caster
<
Type
,
enable_if
_t
<
is_eigen_dense
<
Type
>::
value
&&
is_eigen_ref
<
Type
>::
value
>>
{
protected:
protected:
using
Derived
=
typename
std
::
remove_const
<
typename
is_eigen_ref
<
Type
>::
Derived
>::
type
;
using
Derived
=
typename
std
::
remove_const
<
typename
is_eigen_ref
<
Type
>::
Derived
>::
type
;
using
DerivedCaster
=
type_caster
<
Derived
>
;
using
DerivedCaster
=
type_caster
<
Derived
>
;
...
@@ -181,7 +181,7 @@ public:
...
@@ -181,7 +181,7 @@ public:
// type_caster for special matrix types (e.g. DiagonalMatrix): load() is not supported, but we can
// type_caster for special matrix types (e.g. DiagonalMatrix): load() is not supported, but we can
// cast them into the python domain by first copying to a regular Eigen::Matrix, then casting that.
// cast them into the python domain by first copying to a regular Eigen::Matrix, then casting that.
template
<
typename
Type
>
template
<
typename
Type
>
struct
type_caster
<
Type
,
typename
std
::
enable_if
<
is_eigen_base
<
Type
>::
value
&&
!
is_eigen_ref
<
Type
>::
value
>
::
type
>
{
struct
type_caster
<
Type
,
enable_if
_t
<
is_eigen_base
<
Type
>::
value
&&
!
is_eigen_ref
<
Type
>::
value
>>
{
protected:
protected:
using
Matrix
=
Eigen
::
Matrix
<
typename
Type
::
Scalar
,
Eigen
::
Dynamic
,
Eigen
::
Dynamic
>
;
using
Matrix
=
Eigen
::
Matrix
<
typename
Type
::
Scalar
,
Eigen
::
Dynamic
,
Eigen
::
Dynamic
>
;
using
MatrixCaster
=
type_caster
<
Matrix
>
;
using
MatrixCaster
=
type_caster
<
Matrix
>
;
...
@@ -198,7 +198,7 @@ public:
...
@@ -198,7 +198,7 @@ public:
};
};
template
<
typename
Type
>
template
<
typename
Type
>
struct
type_caster
<
Type
,
typename
std
::
enable_if
<
is_eigen_sparse
<
Type
>::
value
>
::
type
>
{
struct
type_caster
<
Type
,
enable_if
_t
<
is_eigen_sparse
<
Type
>::
value
>>
{
typedef
typename
Type
::
Scalar
Scalar
;
typedef
typename
Type
::
Scalar
Scalar
;
typedef
typename
std
::
remove_reference
<
decltype
(
*
std
::
declval
<
Type
>
().
outerIndexPtr
())
>::
type
StorageIndex
;
typedef
typename
std
::
remove_reference
<
decltype
(
*
std
::
declval
<
Type
>
().
outerIndexPtr
())
>::
type
StorageIndex
;
typedef
typename
Type
::
Index
Index
;
typedef
typename
Type
::
Index
Index
;
...
...
include/pybind11/numpy.h
View file @
c1fc27e2
...
@@ -486,7 +486,7 @@ public:
...
@@ -486,7 +486,7 @@ public:
};
};
template
<
typename
T
>
template
<
typename
T
>
struct
format_descriptor
<
T
,
typename
std
::
enable_if
<
detail
::
is_pod_struct
<
T
>::
value
>
::
type
>
{
struct
format_descriptor
<
T
,
detail
::
enable_if
_t
<
detail
::
is_pod_struct
<
T
>::
value
>>
{
static
std
::
string
format
()
{
static
std
::
string
format
()
{
return
detail
::
npy_format_descriptor
<
typename
std
::
remove_cv
<
T
>::
type
>::
format
();
return
detail
::
npy_format_descriptor
<
typename
std
::
remove_cv
<
T
>::
type
>::
format
();
}
}
...
@@ -517,7 +517,7 @@ struct is_pod_struct {
...
@@ -517,7 +517,7 @@ struct is_pod_struct {
!
std
::
is_same
<
typename
std
::
remove_cv
<
T
>::
type
,
std
::
complex
<
double
>>::
value
};
!
std
::
is_same
<
typename
std
::
remove_cv
<
T
>::
type
,
std
::
complex
<
double
>>::
value
};
};
};
template
<
typename
T
>
struct
npy_format_descriptor
<
T
,
typename
std
::
enable_if
<
std
::
is_integral
<
T
>::
value
>
::
type
>
{
template
<
typename
T
>
struct
npy_format_descriptor
<
T
,
enable_if
_t
<
std
::
is_integral
<
T
>::
value
>>
{
private:
private:
constexpr
static
const
int
values
[
8
]
=
{
constexpr
static
const
int
values
[
8
]
=
{
npy_api
::
NPY_BYTE_
,
npy_api
::
NPY_UBYTE_
,
npy_api
::
NPY_SHORT_
,
npy_api
::
NPY_USHORT_
,
npy_api
::
NPY_BYTE_
,
npy_api
::
NPY_UBYTE_
,
npy_api
::
NPY_SHORT_
,
npy_api
::
NPY_USHORT_
,
...
@@ -529,13 +529,13 @@ public:
...
@@ -529,13 +529,13 @@ public:
return
object
(
ptr
,
true
);
return
object
(
ptr
,
true
);
pybind11_fail
(
"Unsupported buffer format!"
);
pybind11_fail
(
"Unsupported buffer format!"
);
}
}
template
<
typename
T2
=
T
,
typename
std
::
enable_if
<
std
::
is_signed
<
T2
>
::
value
,
int
>
::
type
=
0
>
template
<
typename
T2
=
T
,
enable_if
_t
<
std
::
is_signed
<
T2
>
::
value
,
int
>
=
0
>
static
PYBIND11_DESCR
name
()
{
return
_
(
"int"
)
+
_
<
sizeof
(
T
)
*
8
>
();
}
static
PYBIND11_DESCR
name
()
{
return
_
(
"int"
)
+
_
<
sizeof
(
T
)
*
8
>
();
}
template
<
typename
T2
=
T
,
typename
std
::
enable_if
<!
std
::
is_signed
<
T2
>
::
value
,
int
>
::
type
=
0
>
template
<
typename
T2
=
T
,
enable_if
_t
<!
std
::
is_signed
<
T2
>
::
value
,
int
>
=
0
>
static
PYBIND11_DESCR
name
()
{
return
_
(
"uint"
)
+
_
<
sizeof
(
T
)
*
8
>
();
}
static
PYBIND11_DESCR
name
()
{
return
_
(
"uint"
)
+
_
<
sizeof
(
T
)
*
8
>
();
}
};
};
template
<
typename
T
>
constexpr
const
int
npy_format_descriptor
<
template
<
typename
T
>
constexpr
const
int
npy_format_descriptor
<
T
,
typename
std
::
enable_if
<
std
::
is_integral
<
T
>::
value
>
::
type
>::
values
[
8
];
T
,
enable_if
_t
<
std
::
is_integral
<
T
>::
value
>>::
values
[
8
];
#define DECL_FMT(Type, NumPyName, Name) template<> struct npy_format_descriptor<Type> { \
#define DECL_FMT(Type, NumPyName, Name) template<> struct npy_format_descriptor<Type> { \
enum { value = npy_api::NumPyName }; \
enum { value = npy_api::NumPyName }; \
...
@@ -568,7 +568,7 @@ struct field_descriptor {
...
@@ -568,7 +568,7 @@ struct field_descriptor {
};
};
template
<
typename
T
>
template
<
typename
T
>
struct
npy_format_descriptor
<
T
,
typename
std
::
enable_if
<
is_pod_struct
<
T
>::
value
>
::
type
>
{
struct
npy_format_descriptor
<
T
,
enable_if
_t
<
is_pod_struct
<
T
>::
value
>>
{
static
PYBIND11_DESCR
name
()
{
return
_
(
"struct"
);
}
static
PYBIND11_DESCR
name
()
{
return
_
(
"struct"
);
}
static
pybind11
::
dtype
dtype
()
{
static
pybind11
::
dtype
dtype
()
{
...
@@ -634,9 +634,9 @@ private:
...
@@ -634,9 +634,9 @@ private:
};
};
template
<
typename
T
>
template
<
typename
T
>
std
::
string
npy_format_descriptor
<
T
,
typename
std
::
enable_if
<
is_pod_struct
<
T
>::
value
>
::
type
>::
format_str
;
std
::
string
npy_format_descriptor
<
T
,
enable_if
_t
<
is_pod_struct
<
T
>::
value
>>::
format_str
;
template
<
typename
T
>
template
<
typename
T
>
PyObject
*
npy_format_descriptor
<
T
,
typename
std
::
enable_if
<
is_pod_struct
<
T
>::
value
>
::
type
>::
dtype_ptr
=
nullptr
;
PyObject
*
npy_format_descriptor
<
T
,
enable_if
_t
<
is_pod_struct
<
T
>::
value
>>::
dtype_ptr
=
nullptr
;
// Extract name, offset and format descriptor for a struct field
// Extract name, offset and format descriptor for a struct field
#define PYBIND11_FIELD_DESCRIPTOR(Type, Field) \
#define PYBIND11_FIELD_DESCRIPTOR(Type, Field) \
...
...
include/pybind11/pybind11.h
View file @
c1fc27e2
...
@@ -867,7 +867,7 @@ public:
...
@@ -867,7 +867,7 @@ public:
record
.
dealloc
=
dealloc
;
record
.
dealloc
=
dealloc
;
/* Register base classes specified via template arguments to class_, if any */
/* Register base classes specified via template arguments to class_, if any */
bool
unused
[]
=
{
(
add_base
<
options
>
(
record
),
false
)...
};
bool
unused
[]
=
{
(
add_base
<
options
>
(
record
),
false
)...
,
false
};
(
void
)
unused
;
(
void
)
unused
;
/* Process optional arguments, if any */
/* Process optional arguments, if any */
...
@@ -881,14 +881,14 @@ public:
...
@@ -881,14 +881,14 @@ public:
}
}
}
}
template
<
typename
Base
,
std
::
enable_if_t
<
is_base
<
Base
>
::
value
,
int
>
=
0
>
template
<
typename
Base
,
detail
::
enable_if_t
<
is_base
<
Base
>
::
value
,
int
>
=
0
>
static
void
add_base
(
detail
::
type_record
&
rec
)
{
static
void
add_base
(
detail
::
type_record
&
rec
)
{
rec
.
add_base
(
&
typeid
(
Base
),
[](
void
*
src
)
->
void
*
{
rec
.
add_base
(
&
typeid
(
Base
),
[](
void
*
src
)
->
void
*
{
return
static_cast
<
Base
*>
(
reinterpret_cast
<
type
*>
(
src
));
return
static_cast
<
Base
*>
(
reinterpret_cast
<
type
*>
(
src
));
});
});
}
}
template
<
typename
Base
,
std
::
enable_if_t
<!
is_base
<
Base
>
::
value
,
int
>
=
0
>
template
<
typename
Base
,
detail
::
enable_if_t
<!
is_base
<
Base
>
::
value
,
int
>
=
0
>
static
void
add_base
(
detail
::
type_record
&
)
{
}
static
void
add_base
(
detail
::
type_record
&
)
{
}
template
<
typename
Func
,
typename
...
Extra
>
template
<
typename
Func
,
typename
...
Extra
>
...
@@ -1032,7 +1032,7 @@ private:
...
@@ -1032,7 +1032,7 @@ private:
/// Initialize holder object, variant 2: try to construct from existing holder object, if possible
/// Initialize holder object, variant 2: try to construct from existing holder object, if possible
template
<
typename
T
=
holder_type
,
template
<
typename
T
=
holder_type
,
typename
std
::
enable_if
<
std
::
is_copy_constructible
<
T
>
::
value
,
int
>
::
type
=
0
>
detail
::
enable_if
_t
<
std
::
is_copy_constructible
<
T
>
::
value
,
int
>
=
0
>
static
void
init_holder_helper
(
instance_type
*
inst
,
const
holder_type
*
holder_ptr
,
const
void
*
/* dummy */
)
{
static
void
init_holder_helper
(
instance_type
*
inst
,
const
holder_type
*
holder_ptr
,
const
void
*
/* dummy */
)
{
if
(
holder_ptr
)
if
(
holder_ptr
)
new
(
&
inst
->
holder
)
holder_type
(
*
holder_ptr
);
new
(
&
inst
->
holder
)
holder_type
(
*
holder_ptr
);
...
@@ -1042,7 +1042,7 @@ private:
...
@@ -1042,7 +1042,7 @@ private:
/// Initialize holder object, variant 3: holder is not copy constructible (e.g. unique_ptr), always initialize from raw pointer
/// Initialize holder object, variant 3: holder is not copy constructible (e.g. unique_ptr), always initialize from raw pointer
template
<
typename
T
=
holder_type
,
template
<
typename
T
=
holder_type
,
typename
std
::
enable_if
<!
std
::
is_copy_constructible
<
T
>
::
value
,
int
>
::
type
=
0
>
detail
::
enable_if
_t
<!
std
::
is_copy_constructible
<
T
>
::
value
,
int
>
=
0
>
static
void
init_holder_helper
(
instance_type
*
inst
,
const
holder_type
*
/* unused */
,
const
void
*
/* dummy */
)
{
static
void
init_holder_helper
(
instance_type
*
inst
,
const
holder_type
*
/* unused */
,
const
void
*
/* dummy */
)
{
new
(
&
inst
->
holder
)
holder_type
(
inst
->
value
);
new
(
&
inst
->
holder
)
holder_type
(
inst
->
value
);
}
}
...
...
include/pybind11/pytypes.h
View file @
c1fc27e2
...
@@ -490,7 +490,7 @@ class int_ : public object {
...
@@ -490,7 +490,7 @@ class int_ : public object {
public:
public:
PYBIND11_OBJECT_DEFAULT
(
int_
,
object
,
PYBIND11_LONG_CHECK
)
PYBIND11_OBJECT_DEFAULT
(
int_
,
object
,
PYBIND11_LONG_CHECK
)
template
<
typename
T
,
template
<
typename
T
,
typename
std
::
enable_if
<
std
::
is_integral
<
T
>
::
value
,
int
>
::
type
=
0
>
detail
::
enable_if
_t
<
std
::
is_integral
<
T
>
::
value
,
int
>
=
0
>
int_
(
T
value
)
{
int_
(
T
value
)
{
if
(
sizeof
(
T
)
<=
sizeof
(
long
))
{
if
(
sizeof
(
T
)
<=
sizeof
(
long
))
{
if
(
std
::
is_signed
<
T
>::
value
)
if
(
std
::
is_signed
<
T
>::
value
)
...
@@ -507,7 +507,7 @@ public:
...
@@ -507,7 +507,7 @@ public:
}
}
template
<
typename
T
,
template
<
typename
T
,
typename
std
::
enable_if
<
std
::
is_integral
<
T
>
::
value
,
int
>
::
type
=
0
>
detail
::
enable_if
_t
<
std
::
is_integral
<
T
>
::
value
,
int
>
=
0
>
operator
T
()
const
{
operator
T
()
const
{
if
(
sizeof
(
T
)
<=
sizeof
(
long
))
{
if
(
sizeof
(
T
)
<=
sizeof
(
long
))
{
if
(
std
::
is_signed
<
T
>::
value
)
if
(
std
::
is_signed
<
T
>::
value
)
...
...
include/pybind11/stl.h
View file @
c1fc27e2
...
@@ -112,7 +112,7 @@ template <typename Type, typename Value> struct list_caster {
...
@@ -112,7 +112,7 @@ template <typename Type, typename Value> struct list_caster {
}
}
template
<
typename
T
=
Type
,
template
<
typename
T
=
Type
,
typename
std
::
enable_if
<
std
::
is_same
<
decltype
(
std
::
declval
<
T
>().
reserve
(
0
)),
void
>::
value
,
int
>
::
type
=
0
>
enable_if
_t
<
std
::
is_same
<
decltype
(
std
::
declval
<
T
>().
reserve
(
0
)),
void
>::
value
,
int
>
=
0
>
void
reserve_maybe
(
list
l
,
Type
*
)
{
value
.
reserve
(
l
.
size
());
}
void
reserve_maybe
(
list
l
,
Type
*
)
{
value
.
reserve
(
l
.
size
());
}
void
reserve_maybe
(
list
,
void
*
)
{
}
void
reserve_maybe
(
list
,
void
*
)
{
}
...
...
include/pybind11/stl_bind.h
View file @
c1fc27e2
...
@@ -40,20 +40,20 @@ struct is_comparable : std::false_type { };
...
@@ -40,20 +40,20 @@ struct is_comparable : std::false_type { };
/* For non-map data structures, check whether operator== can be instantiated */
/* For non-map data structures, check whether operator== can be instantiated */
template
<
typename
T
>
template
<
typename
T
>
struct
is_comparable
<
struct
is_comparable
<
T
,
typename
std
::
enable_if
<
container_traits
<
T
>::
is_element
&&
T
,
enable_if
_t
<
container_traits
<
T
>::
is_element
&&
container_traits
<
T
>::
is_comparable
>
::
type
>
container_traits
<
T
>::
is_comparable
>>
:
std
::
true_type
{
};
:
std
::
true_type
{
};
/* For a vector/map data structure, recursively check the value type (which is std::pair for maps) */
/* For a vector/map data structure, recursively check the value type (which is std::pair for maps) */
template
<
typename
T
>
template
<
typename
T
>
struct
is_comparable
<
T
,
typename
std
::
enable_if
<
container_traits
<
T
>::
is_vector
>
::
type
>
{
struct
is_comparable
<
T
,
enable_if
_t
<
container_traits
<
T
>::
is_vector
>>
{
static
constexpr
const
bool
value
=
static
constexpr
const
bool
value
=
is_comparable
<
typename
T
::
value_type
>::
value
;
is_comparable
<
typename
T
::
value_type
>::
value
;
};
};
/* For pairs, recursively check the two data types */
/* For pairs, recursively check the two data types */
template
<
typename
T
>
template
<
typename
T
>
struct
is_comparable
<
T
,
typename
std
::
enable_if
<
container_traits
<
T
>::
is_pair
>
::
type
>
{
struct
is_comparable
<
T
,
enable_if
_t
<
container_traits
<
T
>::
is_pair
>>
{
static
constexpr
const
bool
value
=
static
constexpr
const
bool
value
=
is_comparable
<
typename
T
::
first_type
>::
value
&&
is_comparable
<
typename
T
::
first_type
>::
value
&&
is_comparable
<
typename
T
::
second_type
>::
value
;
is_comparable
<
typename
T
::
second_type
>::
value
;
...
@@ -64,13 +64,13 @@ template <typename, typename, typename... Args> void vector_if_copy_constructibl
...
@@ -64,13 +64,13 @@ template <typename, typename, typename... Args> void vector_if_copy_constructibl
template
<
typename
,
typename
,
typename
...
Args
>
void
vector_if_equal_operator
(
const
Args
&
...)
{
}
template
<
typename
,
typename
,
typename
...
Args
>
void
vector_if_equal_operator
(
const
Args
&
...)
{
}
template
<
typename
,
typename
,
typename
...
Args
>
void
vector_if_insertion_operator
(
const
Args
&
...)
{
}
template
<
typename
,
typename
,
typename
...
Args
>
void
vector_if_insertion_operator
(
const
Args
&
...)
{
}
template
<
typename
Vector
,
typename
Class_
,
typename
std
::
enable_if
<
std
::
is_copy_constructible
<
typename
Vector
::
value_type
>
::
value
,
int
>
::
type
=
0
>
template
<
typename
Vector
,
typename
Class_
,
enable_if
_t
<
std
::
is_copy_constructible
<
typename
Vector
::
value_type
>
::
value
,
int
>
=
0
>
void
vector_if_copy_constructible
(
Class_
&
cl
)
{
void
vector_if_copy_constructible
(
Class_
&
cl
)
{
cl
.
def
(
pybind11
::
init
<
const
Vector
&>
(),
cl
.
def
(
pybind11
::
init
<
const
Vector
&>
(),
"Copy constructor"
);
"Copy constructor"
);
}
}
template
<
typename
Vector
,
typename
Class_
,
typename
std
::
enable_if
<
is_comparable
<
Vector
>
::
value
,
int
>
::
type
=
0
>
template
<
typename
Vector
,
typename
Class_
,
enable_if
_t
<
is_comparable
<
Vector
>
::
value
,
int
>
=
0
>
void
vector_if_equal_operator
(
Class_
&
cl
)
{
void
vector_if_equal_operator
(
Class_
&
cl
)
{
using
T
=
typename
Vector
::
value_type
;
using
T
=
typename
Vector
::
value_type
;
...
@@ -376,7 +376,7 @@ template <typename Map, typename Class_, typename... Args> void map_if_copy_assi
...
@@ -376,7 +376,7 @@ template <typename Map, typename Class_, typename... Args> void map_if_copy_assi
);
);
}
}
template
<
typename
Map
,
typename
Class_
,
typename
std
::
enable_if
<!
std
::
is_copy_assignable
<
typename
Map
::
mapped_type
>
::
value
,
int
>
::
type
=
0
>
template
<
typename
Map
,
typename
Class_
,
enable_if
_t
<!
std
::
is_copy_assignable
<
typename
Map
::
mapped_type
>
::
value
,
int
>
=
0
>
void
map_if_copy_assignable
(
Class_
&
cl
)
{
void
map_if_copy_assignable
(
Class_
&
cl
)
{
using
KeyType
=
typename
Map
::
key_type
;
using
KeyType
=
typename
Map
::
key_type
;
using
MappedType
=
typename
Map
::
mapped_type
;
using
MappedType
=
typename
Map
::
mapped_type
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment