Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
b40ce578
Commit
b40ce578
authored
Feb 13, 2021
by
Ralf W. Grosse-Kunstleve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DEBUGGING_MSVC_2015: implemening is_smart_holder_type_caster based on std::is_base_of.
parent
cd9e99ed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
16 deletions
+17
-16
include/pybind11/cast.h
+16
-15
include/pybind11/pybind11.h
+1
-1
No files found.
include/pybind11/cast.h
View file @
b40ce578
...
...
@@ -1218,19 +1218,11 @@ struct smart_holder_type_caster_class_hooks {
}
};
template
<
typename
T
>
struct
is_smart_holder_type_caster
{
#ifndef PYBIND11_USE_SMART_HOLDER_AS_DEFAULT
static
constexpr
bool
value
=
false
;
#else
static
constexpr
bool
value
=
true
;
#endif
};
template
<
typename
T
,
typename
SFINAE
=
void
>
struct
is_smart_holder_type_caster
{
static
constexpr
bool
value
=
false
;
};
template
<
typename
T
>
inline
bool
check_is_smart_holder_type_caster
()
{
return
detail
::
is_smart_holder_type_caster
<
T
>::
value
;
}
inline
bool
check_is_smart_holder_type_caster
();
template
<
typename
T
>
struct
smart_holder_type_caster_load
{
...
...
@@ -1638,8 +1630,6 @@ struct smart_holder_type_caster<std::unique_ptr<T const, D>>
namespace pybind11 { \
namespace detail { \
template <> \
struct is_smart_holder_type_caster<T> { static constexpr bool value = true; }; \
template <> \
class type_caster<T> : public smart_holder_type_caster<T> {}; \
template <> \
class type_caster<std::shared_ptr<T>> : public smart_holder_type_caster<std::shared_ptr<T>> { \
...
...
@@ -1671,8 +1661,6 @@ template <typename T> class type_caster_for_class_ : public type_caster_base<T>
namespace pybind11 { \
namespace detail { \
template <> \
struct is_smart_holder_type_caster<T> { static constexpr bool value = false; }; \
template <> \
class type_caster<T> : public type_caster_base<T> {}; \
template <> \
class type_caster<__VA_ARGS__> : public type_caster_holder<T, __VA_ARGS__> {}; \
...
...
@@ -1704,6 +1692,19 @@ template <typename type, typename SFINAE = void> class type_caster : public type
template
<
typename
type
>
using
make_caster
=
type_caster
<
intrinsic_t
<
type
>>
;
template
<
typename
T
>
struct
is_smart_holder_type_caster
<
T
,
typename
std
::
enable_if
<
std
::
is_base_of
<
smart_holder_type_caster_class_hooks
,
make_caster
<
T
>>::
value
>::
type
>
{
static
constexpr
bool
value
=
true
;
};
template
<
typename
T
>
inline
bool
check_is_smart_holder_type_caster
()
{
return
detail
::
is_smart_holder_type_caster
<
T
>::
value
;
}
// Shortcut for calling a caster's `cast_op_type` cast operator for casting a type_caster to a T
template
<
typename
T
>
typename
make_caster
<
T
>::
template
cast_op_type
<
T
>
cast_op
(
make_caster
<
T
>
&
caster
)
{
return
caster
.
operator
typename
make_caster
<
T
>::
template
cast_op_type
<
T
>
();
...
...
include/pybind11/pybind11.h
View file @
b40ce578
...
...
@@ -1286,7 +1286,7 @@ public:
none_of
<
std
::
is_same
<
multiple_inheritance
,
Extra
>
...
>::
value
),
// no multiple_inheritance attr
"Error: multiple inheritance bases must be specified via class_ template options"
);
# if
0
# if
1
static
constexpr
bool
holder_is_smart_holder
=
std
::
is_same
<
holder_type
,
smart_holder
>::
value
;
static
constexpr
bool
type_caster_type_is_smart_holder_type_caster
=
detail
::
is_smart_holder_type_caster
<
type
>::
value
;
static
constexpr
bool
type_caster_type_is_type_caster_base_subtype
=
std
::
is_base_of
<
detail
::
type_caster_base
<
type
>
,
detail
::
type_caster
<
type
>>::
value
;
...
...
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