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
e6a3215c
Commit
e6a3215c
authored
Dec 01, 2020
by
Ralf W. Grosse-Kunstleve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renaming holder_helper<T>::get to yyy_get, to pin-point where it is used
parent
44805c16
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
include/pybind11/cast.h
+4
-4
include/pybind11/detail/init.h
+1
-1
tests/test_smart_ptr.cpp
+1
-1
No files found.
include/pybind11/cast.h
View file @
e6a3215c
...
@@ -1488,7 +1488,7 @@ template <typename... Ts> class type_caster<std::tuple<Ts...>>
...
@@ -1488,7 +1488,7 @@ template <typename... Ts> class type_caster<std::tuple<Ts...>>
/// custom holders, but it's only necessary if the type has a non-standard interface.
/// custom holders, but it's only necessary if the type has a non-standard interface.
template
<
typename
T
>
template
<
typename
T
>
struct
holder_helper
{
struct
holder_helper
{
static
auto
get
(
const
T
&
p
)
->
decltype
(
p
.
get
())
{
return
p
.
get
();
}
static
auto
yyy_get
(
const
T
&
p
)
->
decltype
(
p
.
get
())
{
return
p
.
get
();
}
// default implementation
};
};
/// Type caster for holder types like std::shared_ptr, etc.
/// Type caster for holder types like std::shared_ptr, etc.
...
@@ -1515,7 +1515,7 @@ public:
...
@@ -1515,7 +1515,7 @@ public:
explicit
operator
holder_type
&
()
{
return
holder
;
}
explicit
operator
holder_type
&
()
{
return
holder
;
}
static
handle
cast
(
const
holder_type
&
src
,
return_value_policy
,
handle
)
{
static
handle
cast
(
const
holder_type
&
src
,
return_value_policy
,
handle
)
{
const
auto
*
ptr
=
holder_helper
<
holder_type
>::
get
(
src
);
const
auto
*
ptr
=
holder_helper
<
holder_type
>::
yyy_get
(
src
);
// copyable_holder_caster::cast
return
type_caster_base
<
type
>::
cast_holder
(
ptr
,
&
src
);
return
type_caster_base
<
type
>::
cast_holder
(
ptr
,
&
src
);
}
}
...
@@ -1530,7 +1530,7 @@ protected:
...
@@ -1530,7 +1530,7 @@ protected:
if
(
v_h
.
holder_constructed
())
{
if
(
v_h
.
holder_constructed
())
{
value
=
v_h
.
xxx_value_ptr
<
void
>
();
value
=
v_h
.
xxx_value_ptr
<
void
>
();
holder
=
v_h
.
template
xxx_holder
<
holder_type
>
();
holder
=
v_h
.
template
xxx_holder
<
holder_type
>
();
if
(
holder_helper
<
holder_type
>::
get
(
holder
)
!=
value
)
{
if
(
holder_helper
<
holder_type
>::
yyy_get
(
holder
)
!=
value
)
{
// copyable_holder_caster::load_value consistency check added by rwgk@
throw
std
::
runtime_error
(
"holder.get() != value in copyable_holder_caster::load_value"
);
throw
std
::
runtime_error
(
"holder.get() != value in copyable_holder_caster::load_value"
);
}
}
return
true
;
return
true
;
...
@@ -1576,7 +1576,7 @@ struct move_only_holder_caster {
...
@@ -1576,7 +1576,7 @@ struct move_only_holder_caster {
"Holder classes are only supported for custom types"
);
"Holder classes are only supported for custom types"
);
static
handle
cast
(
holder_type
&&
src
,
return_value_policy
,
handle
)
{
static
handle
cast
(
holder_type
&&
src
,
return_value_policy
,
handle
)
{
auto
*
ptr
=
holder_helper
<
holder_type
>::
get
(
src
);
auto
*
ptr
=
holder_helper
<
holder_type
>::
yyy_get
(
src
);
// move_only_holder_caster::cast
return
type_caster_base
<
type
>::
cast_holder
(
ptr
,
std
::
addressof
(
src
));
return
type_caster_base
<
type
>::
cast_holder
(
ptr
,
std
::
addressof
(
src
));
}
}
static
constexpr
auto
name
=
type_caster_base
<
type
>::
name
;
static
constexpr
auto
name
=
type_caster_base
<
type
>::
name
;
...
...
include/pybind11/detail/init.h
View file @
e6a3215c
...
@@ -131,7 +131,7 @@ void construct(value_and_holder &v_h, Alias<Class> *alias_ptr, bool) {
...
@@ -131,7 +131,7 @@ void construct(value_and_holder &v_h, Alias<Class> *alias_ptr, bool) {
// derived type (through those holder's implicit conversion from derived class holder constructors).
// derived type (through those holder's implicit conversion from derived class holder constructors).
template
<
typename
Class
>
template
<
typename
Class
>
void
construct
(
value_and_holder
&
v_h
,
Holder
<
Class
>
holder
,
bool
need_alias
)
{
void
construct
(
value_and_holder
&
v_h
,
Holder
<
Class
>
holder
,
bool
need_alias
)
{
auto
*
ptr
=
holder_helper
<
Holder
<
Class
>>::
get
(
holder
);
auto
*
ptr
=
holder_helper
<
Holder
<
Class
>>::
yyy_get
(
holder
);
// construct from holder
no_nullptr
(
ptr
);
no_nullptr
(
ptr
);
// If we need an alias, check that the held pointer is actually an alias instance
// If we need an alias, check that the held pointer is actually an alias instance
if
(
Class
::
has_alias
&&
need_alias
&&
!
is_alias
<
Class
>
(
ptr
))
if
(
Class
::
has_alias
&&
need_alias
&&
!
is_alias
<
Class
>
(
ptr
))
...
...
tests/test_smart_ptr.cpp
View file @
e6a3215c
...
@@ -25,7 +25,7 @@ PYBIND11_DECLARE_HOLDER_TYPE(T, ref<T>, true);
...
@@ -25,7 +25,7 @@ PYBIND11_DECLARE_HOLDER_TYPE(T, ref<T>, true);
namespace
pybind11
{
namespace
detail
{
namespace
pybind11
{
namespace
detail
{
template
<
typename
T
>
template
<
typename
T
>
struct
holder_helper
<
ref
<
T
>>
{
struct
holder_helper
<
ref
<
T
>>
{
static
const
T
*
get
(
const
ref
<
T
>
&
p
)
{
return
p
.
get_ptr
();
}
static
const
T
*
yyy_
get
(
const
ref
<
T
>
&
p
)
{
return
p
.
get_ptr
();
}
};
};
}
// namespace detail
}
// namespace detail
}
// namespace pybind11
}
// namespace pybind11
...
...
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