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
cd9e99ed
Commit
cd9e99ed
authored
Feb 13, 2021
by
Ralf W. Grosse-Kunstleve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DEBUGGING_MSVC_2015: more conventional implementation of is_smart_holder_type_caster.
parent
a0e1c709
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
include/pybind11/cast.h
+16
-15
No files found.
include/pybind11/cast.h
View file @
cd9e99ed
...
@@ -1186,8 +1186,6 @@ public:
...
@@ -1186,8 +1186,6 @@ public:
// clang-format on
// clang-format on
struct
smart_holder_type_caster_class_hooks
{
struct
smart_holder_type_caster_class_hooks
{
struct
is_smart_holder_type_caster
{
static
constexpr
bool
value
=
true
;
};
static
decltype
(
&
modified_type_caster_generic_load_impl
::
local_load
)
static
decltype
(
&
modified_type_caster_generic_load_impl
::
local_load
)
get_local_load_function_ptr
()
{
get_local_load_function_ptr
()
{
return
&
modified_type_caster_generic_load_impl
::
local_load
;
return
&
modified_type_caster_generic_load_impl
::
local_load
;
...
@@ -1221,7 +1219,18 @@ struct smart_holder_type_caster_class_hooks {
...
@@ -1221,7 +1219,18 @@ struct smart_holder_type_caster_class_hooks {
};
};
template
<
typename
T
>
template
<
typename
T
>
inline
bool
check_is_smart_holder_type_caster
();
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
>
inline
bool
check_is_smart_holder_type_caster
()
{
return
detail
::
is_smart_holder_type_caster
<
T
>::
value
;
}
template
<
typename
T
>
template
<
typename
T
>
struct
smart_holder_type_caster_load
{
struct
smart_holder_type_caster_load
{
...
@@ -1629,6 +1638,8 @@ struct smart_holder_type_caster<std::unique_ptr<T const, D>>
...
@@ -1629,6 +1638,8 @@ struct smart_holder_type_caster<std::unique_ptr<T const, D>>
namespace pybind11 { \
namespace pybind11 { \
namespace detail { \
namespace detail { \
template <> \
template <> \
struct is_smart_holder_type_caster<T> { static constexpr bool value = true; }; \
template <> \
class type_caster<T> : public smart_holder_type_caster<T> {}; \
class type_caster<T> : public smart_holder_type_caster<T> {}; \
template <> \
template <> \
class type_caster<std::shared_ptr<T>> : public smart_holder_type_caster<std::shared_ptr<T>> { \
class type_caster<std::shared_ptr<T>> : public smart_holder_type_caster<std::shared_ptr<T>> { \
...
@@ -1660,6 +1671,8 @@ template <typename T> class type_caster_for_class_ : public type_caster_base<T>
...
@@ -1660,6 +1671,8 @@ template <typename T> class type_caster_for_class_ : public type_caster_base<T>
namespace pybind11 { \
namespace pybind11 { \
namespace detail { \
namespace detail { \
template <> \
template <> \
struct is_smart_holder_type_caster<T> { static constexpr bool value = false; }; \
template <> \
class type_caster<T> : public type_caster_base<T> {}; \
class type_caster<T> : public type_caster_base<T> {}; \
template <> \
template <> \
class type_caster<__VA_ARGS__> : public type_caster_holder<T, __VA_ARGS__> {}; \
class type_caster<__VA_ARGS__> : public type_caster_holder<T, __VA_ARGS__> {}; \
...
@@ -2458,18 +2471,6 @@ template <typename T> struct move_if_unreferenced<T, enable_if_t<all_of<
...
@@ -2458,18 +2471,6 @@ template <typename T> struct move_if_unreferenced<T, enable_if_t<all_of<
>::
value
>>
:
std
::
true_type
{};
>::
value
>>
:
std
::
true_type
{};
template
<
typename
T
>
using
move_never
=
none_of
<
move_always
<
T
>
,
move_if_unreferenced
<
T
>>
;
template
<
typename
T
>
using
move_never
=
none_of
<
move_always
<
T
>
,
move_if_unreferenced
<
T
>>
;
template
<
typename
T
,
typename
SFINAE
=
void
>
struct
is_smart_holder_type_caster
{
static
constexpr
bool
value
=
false
;
};
template
<
typename
T
>
struct
is_smart_holder_type_caster
<
T
,
typename
std
::
enable_if
<
type_caster
<
T
>::
is_smart_holder_type_caster
::
value
,
void
>::
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
;
}
// 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
// reference or pointer to a local variable of the type_caster. Basically, only
// reference or pointer to a local variable of the type_caster. Basically, only
// non-reference/pointer `type`s and reference/pointers from a type_caster_generic are safe;
// non-reference/pointer `type`s and reference/pointers from a type_caster_generic are safe;
...
...
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