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
2a58b535
Commit
2a58b535
authored
Feb 14, 2021
by
Ralf W. Grosse-Kunstleve
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test_unique_ptr_member' into pr2672_use_smart_holder_as_default
parents
8a782ab8
8d1fbee4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
include/pybind11/detail/init.h
+3
-3
include/pybind11/pybind11.h
+4
-4
No files found.
include/pybind11/detail/init.h
View file @
2a58b535
...
@@ -132,7 +132,7 @@ void construct(value_and_holder &v_h, Alias<Class> *alias_ptr, bool) {
...
@@ -132,7 +132,7 @@ void construct(value_and_holder &v_h, Alias<Class> *alias_ptr, bool) {
// holder. This also handles types like std::shared_ptr<T> and std::unique_ptr<T> where T is a
// holder. This also handles types like std::shared_ptr<T> and std::unique_ptr<T> where T is a
// 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
,
typename
std
::
enable_if
<!
detail
::
is_smart_holder_type_caster
<
Cpp
<
Class
>>::
value
,
int
>::
type
=
0
>
detail
::
enable_if_t
<!
detail
::
is_smart_holder_type_caster
<
Cpp
<
Class
>>::
value
,
int
>
=
0
>
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
>>::
get
(
holder
);
no_nullptr
(
ptr
);
no_nullptr
(
ptr
);
...
@@ -172,7 +172,7 @@ void construct(value_and_holder &v_h, Alias<Class> &&result, bool) {
...
@@ -172,7 +172,7 @@ void construct(value_and_holder &v_h, Alias<Class> &&result, bool) {
//DETAIL/SMART_HOLDER_INIT_H/BEGIN/////////////////////////////////////////////////////////////////
//DETAIL/SMART_HOLDER_INIT_H/BEGIN/////////////////////////////////////////////////////////////////
template
<
typename
Class
,
typename
D
=
std
::
default_delete
<
Cpp
<
Class
>>
,
template
<
typename
Class
,
typename
D
=
std
::
default_delete
<
Cpp
<
Class
>>
,
typename
std
::
enable_if
<
detail
::
is_smart_holder_type_caster
<
Cpp
<
Class
>>::
value
,
int
>::
type
=
0
>
detail
::
enable_if_t
<
detail
::
is_smart_holder_type_caster
<
Cpp
<
Class
>>::
value
,
int
>
=
0
>
void
construct
(
value_and_holder
&
v_h
,
std
::
unique_ptr
<
Cpp
<
Class
>
,
D
>
&&
unq_ptr
,
bool
need_alias
)
{
void
construct
(
value_and_holder
&
v_h
,
std
::
unique_ptr
<
Cpp
<
Class
>
,
D
>
&&
unq_ptr
,
bool
need_alias
)
{
auto
*
ptr
=
unq_ptr
.
get
();
auto
*
ptr
=
unq_ptr
.
get
();
no_nullptr
(
ptr
);
no_nullptr
(
ptr
);
...
@@ -188,7 +188,7 @@ void construct(value_and_holder &v_h, std::unique_ptr<Cpp<Class>, D> &&unq_ptr,
...
@@ -188,7 +188,7 @@ void construct(value_and_holder &v_h, std::unique_ptr<Cpp<Class>, D> &&unq_ptr,
}
}
template
<
typename
Class
,
template
<
typename
Class
,
typename
std
::
enable_if
<
detail
::
is_smart_holder_type_caster
<
Cpp
<
Class
>>::
value
,
int
>::
type
=
0
>
detail
::
enable_if_t
<
detail
::
is_smart_holder_type_caster
<
Cpp
<
Class
>>::
value
,
int
>
=
0
>
void
construct
(
value_and_holder
&
v_h
,
std
::
shared_ptr
<
Cpp
<
Class
>>
&&
shd_ptr
,
bool
need_alias
)
{
void
construct
(
value_and_holder
&
v_h
,
std
::
shared_ptr
<
Cpp
<
Class
>>
&&
shd_ptr
,
bool
need_alias
)
{
auto
*
ptr
=
shd_ptr
.
get
();
auto
*
ptr
=
shd_ptr
.
get
();
no_nullptr
(
ptr
);
no_nullptr
(
ptr
);
...
...
include/pybind11/pybind11.h
View file @
2a58b535
...
@@ -1544,14 +1544,14 @@ public:
...
@@ -1544,14 +1544,14 @@ public:
private
:
private
:
template
<
template
<
typename
T
=
type
,
typename
T
=
type
,
typename
std
::
enable_if
<!
detail
::
is_smart_holder_type_caster
<
T
>::
value
,
int
>::
type
=
0
>
detail
::
enable_if_t
<!
detail
::
is_smart_holder_type_caster
<
T
>::
value
,
int
>
=
0
>
void
generic_type_initialize
(
const
detail
::
type_record
&
record
)
{
void
generic_type_initialize
(
const
detail
::
type_record
&
record
)
{
generic_type
::
initialize
(
record
,
&
detail
::
type_caster_generic
::
local_load
);
generic_type
::
initialize
(
record
,
&
detail
::
type_caster_generic
::
local_load
);
}
}
template
<
template
<
typename
T
=
type
,
typename
T
=
type
,
typename
std
::
enable_if
<
detail
::
is_smart_holder_type_caster
<
T
>::
value
,
int
>::
type
=
0
>
detail
::
enable_if_t
<
detail
::
is_smart_holder_type_caster
<
T
>::
value
,
int
>
=
0
>
void
generic_type_initialize
(
const
detail
::
type_record
&
record
)
{
void
generic_type_initialize
(
const
detail
::
type_record
&
record
)
{
generic_type
::
initialize
(
record
,
detail
::
type_caster
<
T
>::
get_local_load_function_ptr
());
generic_type
::
initialize
(
record
,
detail
::
type_caster
<
T
>::
get_local_load_function_ptr
());
}
}
...
@@ -1602,7 +1602,7 @@ private:
...
@@ -1602,7 +1602,7 @@ private:
/// `.owned`, a new holder will be constructed to manage the value pointer.
/// `.owned`, a new holder will be constructed to manage the value pointer.
template
<
template
<
typename
T
=
type
,
typename
T
=
type
,
typename
std
::
enable_if
<!
detail
::
is_smart_holder_type_caster
<
T
>::
value
,
int
>::
type
=
0
>
detail
::
enable_if_t
<!
detail
::
is_smart_holder_type_caster
<
T
>::
value
,
int
>
=
0
>
static
void
init_instance
(
detail
::
instance
*
inst
,
const
void
*
holder_ptr
)
{
static
void
init_instance
(
detail
::
instance
*
inst
,
const
void
*
holder_ptr
)
{
auto
v_h
=
inst
->
get_value_and_holder
(
detail
::
get_type_info
(
typeid
(
type
)));
auto
v_h
=
inst
->
get_value_and_holder
(
detail
::
get_type_info
(
typeid
(
type
)));
if
(
!
v_h
.
instance_registered
())
{
if
(
!
v_h
.
instance_registered
())
{
...
@@ -1614,7 +1614,7 @@ private:
...
@@ -1614,7 +1614,7 @@ private:
template
<
template
<
typename
T
=
type
,
typename
T
=
type
,
typename
std
::
enable_if
<
detail
::
is_smart_holder_type_caster
<
T
>::
value
,
int
>::
type
=
0
>
detail
::
enable_if_t
<
detail
::
is_smart_holder_type_caster
<
T
>::
value
,
int
>
=
0
>
static
void
init_instance
(
detail
::
instance
*
inst
,
const
void
*
holder_ptr
)
{
static
void
init_instance
(
detail
::
instance
*
inst
,
const
void
*
holder_ptr
)
{
detail
::
type_caster
<
T
>::
template
init_instance_for_type
<
type
>
(
inst
,
holder_ptr
);
detail
::
type_caster
<
T
>::
template
init_instance_for_type
<
type
>
(
inst
,
holder_ptr
);
}
}
...
...
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