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
1dcf115b
Commit
1dcf115b
authored
Feb 04, 2021
by
Ralf W. Grosse-Kunstleve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using __VA_ARGS__ in PYBIND11_SMART_POINTER_HOLDER_TYPE_CASTERS.
parent
75f7eca2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
7 deletions
+5
-7
include/pybind11/cast.h
+3
-3
tests/test_smart_ptr.cpp
+2
-4
No files found.
include/pybind11/cast.h
View file @
1dcf115b
...
...
@@ -1589,19 +1589,19 @@ struct smart_holder_type_caster<std::unique_ptr<T const, D>>
#ifndef PYBIND11_USE_SMART_HOLDER_AS_DEFAULT
#define PYBIND11_SMART_POINTER_HOLDER_TYPE_CASTERS(T,
H
)
#define PYBIND11_SMART_POINTER_HOLDER_TYPE_CASTERS(T,
...
)
template
<
typename
T
>
class
type_caster_for_class_
:
public
type_caster_base
<
T
>
{};
#else
#define PYBIND11_SMART_POINTER_HOLDER_TYPE_CASTERS(T,
H)
\
#define PYBIND11_SMART_POINTER_HOLDER_TYPE_CASTERS(T,
...)
\
namespace pybind11 { \
namespace detail { \
template <> \
class type_caster<T> : public type_caster_base<T> {}; \
template <> \
class type_caster<
H> : public type_caster_holder<T, H> {};
\
class type_caster<
__VA_ARGS__> : public type_caster_holder<T, __VA_ARGS__> {};
\
} \
}
...
...
tests/test_smart_ptr.cpp
View file @
1dcf115b
...
...
@@ -275,10 +275,8 @@ PYBIND11_SMART_POINTER_HOLDER_TYPE_CASTERS(Object, ref<Object>)
PYBIND11_SMART_POINTER_HOLDER_TYPE_CASTERS
(
MyObject1
,
ref
<
MyObject1
>
)
PYBIND11_SMART_POINTER_HOLDER_TYPE_CASTERS
(
MyObject2
,
std
::
shared_ptr
<
MyObject2
>
)
PYBIND11_SMART_POINTER_HOLDER_TYPE_CASTERS
(
MyObject3
,
std
::
shared_ptr
<
MyObject3
>
)
using
unique_ptr_myobject4_nodelete
=
std
::
unique_ptr
<
MyObject4
,
py
::
nodelete
>
;
PYBIND11_SMART_POINTER_HOLDER_TYPE_CASTERS
(
MyObject4
,
unique_ptr_myobject4_nodelete
)
using
unique_ptr_myobject4a_nodelete
=
std
::
unique_ptr
<
MyObject4a
,
py
::
nodelete
>
;
PYBIND11_SMART_POINTER_HOLDER_TYPE_CASTERS
(
MyObject4a
,
unique_ptr_myobject4a_nodelete
)
PYBIND11_SMART_POINTER_HOLDER_TYPE_CASTERS
(
MyObject4
,
std
::
unique_ptr
<
MyObject4
,
py
::
nodelete
>
)
PYBIND11_SMART_POINTER_HOLDER_TYPE_CASTERS
(
MyObject4a
,
std
::
unique_ptr
<
MyObject4a
,
py
::
nodelete
>
)
PYBIND11_SMART_POINTER_HOLDER_TYPE_CASTERS
(
MyObject4b
,
std
::
unique_ptr
<
MyObject4b
>
)
PYBIND11_SMART_POINTER_HOLDER_TYPE_CASTERS
(
MyObject5
,
huge_unique_ptr
<
MyObject5
>
)
PYBIND11_SMART_POINTER_HOLDER_TYPE_CASTERS
(
SharedPtrRef
::
A
,
std
::
shared_ptr
<
SharedPtrRef
::
A
>
)
...
...
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