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
a265c688
Commit
a265c688
authored
Jan 23, 2021
by
Ralf W. Grosse-Kunstleve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moving const after type name, for functions that cover a systematic scheme. NO functional changes.
parent
77eefd0b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
15 deletions
+12
-15
tests/test_classh_inheritance.cpp
+12
-15
No files found.
tests/test_classh_inheritance.cpp
View file @
a265c688
...
...
@@ -23,8 +23,8 @@ struct drvd : base {
inline
drvd
*
rtrn_mptr_drvd
()
{
return
new
drvd
;
}
inline
base
*
rtrn_mptr_drvd_up_cast
()
{
return
new
drvd
;
}
inline
int
pass_cptr_base
(
const
base
*
b
)
{
return
b
->
id
()
+
11
;
}
inline
int
pass_cptr_drvd
(
const
drvd
*
d
)
{
return
d
->
id
()
+
12
;
}
inline
int
pass_cptr_base
(
base
const
*
b
)
{
return
b
->
id
()
+
11
;
}
inline
int
pass_cptr_drvd
(
drvd
const
*
d
)
{
return
d
->
id
()
+
12
;
}
// clang-format on
using
base1
=
base_template
<
110
>
;
...
...
@@ -40,9 +40,9 @@ inline drvd2 *rtrn_mptr_drvd2() { return new drvd2; }
inline
base1
*
rtrn_mptr_drvd2_up_cast1
()
{
return
new
drvd2
;
}
inline
base2
*
rtrn_mptr_drvd2_up_cast2
()
{
return
new
drvd2
;
}
inline
int
pass_cptr_base1
(
const
base1
*
b
)
{
return
b
->
id
()
+
21
;
}
inline
int
pass_cptr_base2
(
const
base2
*
b
)
{
return
b
->
id
()
+
22
;
}
inline
int
pass_cptr_drvd2
(
const
drvd2
*
d
)
{
return
d
->
id
()
+
23
;
}
inline
int
pass_cptr_base1
(
base1
const
*
b
)
{
return
b
->
id
()
+
21
;
}
inline
int
pass_cptr_base2
(
base2
const
*
b
)
{
return
b
->
id
()
+
22
;
}
inline
int
pass_cptr_drvd2
(
drvd2
const
*
d
)
{
return
d
->
id
()
+
23
;
}
// clang-format on
}
// namespace classh_inheritance
...
...
@@ -62,9 +62,10 @@ TEST_SUBMODULE(classh_inheritance, m) {
py
::
classh
<
base
>
(
m
,
"base"
);
py
::
classh
<
drvd
,
base
>
(
m
,
"drvd"
);
m
.
def
(
"rtrn_mptr_drvd"
,
rtrn_mptr_drvd
,
py
::
return_value_policy
::
take_ownership
);
m
.
def
(
"rtrn_mptr_drvd_up_cast"
,
rtrn_mptr_drvd_up_cast
,
py
::
return_value_policy
::
take_ownership
);
auto
rvto
=
py
::
return_value_policy
::
take_ownership
;
m
.
def
(
"rtrn_mptr_drvd"
,
rtrn_mptr_drvd
,
rvto
);
m
.
def
(
"rtrn_mptr_drvd_up_cast"
,
rtrn_mptr_drvd_up_cast
,
rvto
);
m
.
def
(
"pass_cptr_base"
,
pass_cptr_base
);
m
.
def
(
"pass_cptr_drvd"
,
pass_cptr_drvd
);
...
...
@@ -72,13 +73,9 @@ TEST_SUBMODULE(classh_inheritance, m) {
py
::
classh
<
base2
>
(
m
,
"base2"
).
def
(
py
::
init
<>
());
py
::
classh
<
drvd2
,
base1
,
base2
>
(
m
,
"drvd2"
);
m
.
def
(
"rtrn_mptr_drvd2"
,
rtrn_mptr_drvd2
,
py
::
return_value_policy
::
take_ownership
);
m
.
def
(
"rtrn_mptr_drvd2_up_cast1"
,
rtrn_mptr_drvd2_up_cast1
,
py
::
return_value_policy
::
take_ownership
);
m
.
def
(
"rtrn_mptr_drvd2_up_cast2"
,
rtrn_mptr_drvd2_up_cast2
,
py
::
return_value_policy
::
take_ownership
);
m
.
def
(
"rtrn_mptr_drvd2"
,
rtrn_mptr_drvd2
,
rvto
);
m
.
def
(
"rtrn_mptr_drvd2_up_cast1"
,
rtrn_mptr_drvd2_up_cast1
,
rvto
);
m
.
def
(
"rtrn_mptr_drvd2_up_cast2"
,
rtrn_mptr_drvd2_up_cast2
,
rvto
);
m
.
def
(
"pass_cptr_base1"
,
pass_cptr_base1
);
m
.
def
(
"pass_cptr_base2"
,
pass_cptr_base2
);
m
.
def
(
"pass_cptr_drvd2"
,
pass_cptr_drvd2
);
...
...
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