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
231bd84f
Commit
231bd84f
authored
Jan 30, 2021
by
Ralf W. Grosse-Kunstleve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moving up is_smart_holder_type_caster, to also use in cast_is_temporary_value_reference.
parent
692270a0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
include/pybind11/cast.h
+9
-8
No files found.
include/pybind11/cast.h
View file @
231bd84f
...
@@ -1717,6 +1717,13 @@ template <typename T> struct move_if_unreferenced<T, enable_if_t<all_of<
...
@@ -1717,6 +1717,13 @@ 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
:
std
::
false_type
{};
template
<
typename
T
>
struct
is_smart_holder_type_caster
<
T
,
enable_if_t
<
type_caster
<
T
>::
is_smart_holder_type_caster
::
value
,
void
>>
:
std
::
true_type
{};
// 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;
...
@@ -1724,7 +1731,8 @@ template <typename T> using move_never = none_of<move_always<T>, move_if_unrefer
...
@@ -1724,7 +1731,8 @@ template <typename T> using move_never = none_of<move_always<T>, move_if_unrefer
template
<
typename
type
>
using
cast_is_temporary_value_reference
=
bool_constant
<
template
<
typename
type
>
using
cast_is_temporary_value_reference
=
bool_constant
<
(
std
::
is_reference
<
type
>::
value
||
std
::
is_pointer
<
type
>::
value
)
&&
(
std
::
is_reference
<
type
>::
value
||
std
::
is_pointer
<
type
>::
value
)
&&
!
std
::
is_base_of
<
type_caster_generic
,
make_caster
<
type
>>::
value
&&
!
std
::
is_base_of
<
type_caster_generic
,
make_caster
<
type
>>::
value
&&
!
std
::
is_same
<
intrinsic_t
<
type
>
,
void
>::
value
!
std
::
is_same
<
intrinsic_t
<
type
>
,
void
>::
value
&&
!
is_smart_holder_type_caster
<
intrinsic_t
<
type
>>::
value
>
;
>
;
// When a value returned from a C++ function is being cast back to Python, we almost always want to
// When a value returned from a C++ function is being cast back to Python, we almost always want to
...
@@ -2261,13 +2269,6 @@ object object_api<Derived>::call(Args &&...args) const {
...
@@ -2261,13 +2269,6 @@ object object_api<Derived>::call(Args &&...args) const {
return
operator
()
<
policy
>
(
std
::
forward
<
Args
>
(
args
)...);
return
operator
()
<
policy
>
(
std
::
forward
<
Args
>
(
args
)...);
}
}
template
<
typename
T
,
typename
SFINAE
=
void
>
struct
is_smart_holder_type_caster
:
std
::
false_type
{};
template
<
typename
T
>
struct
is_smart_holder_type_caster
<
T
,
enable_if_t
<
type_caster
<
T
>::
is_smart_holder_type_caster
::
value
,
void
>>
:
std
::
true_type
{};
PYBIND11_NAMESPACE_END
(
detail
)
PYBIND11_NAMESPACE_END
(
detail
)
...
...
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