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
e7074970
Commit
e7074970
authored
Apr 30, 2016
by
Wenzel Jakob
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restructured code in issues.cpp
parent
ffd85b46
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
15 deletions
+11
-15
example/issues.cpp
+11
-15
No files found.
example/issues.cpp
View file @
e7074970
...
...
@@ -10,20 +10,6 @@
#include "example.h"
#include <pybind11/stl.h>
struct
Base
{
virtual
void
dispatch
(
void
)
const
=
0
;
};
struct
DispatchIssue
:
Base
{
virtual
void
dispatch
(
void
)
const
{
PYBIND11_OVERLOAD_PURE
(
void
,
Base
,
dispatch
,
/* no arguments */
);
}
};
struct
Placeholder
{
int
i
;
Placeholder
(
int
i
)
:
i
(
i
)
{
}
};
void
dispatch_issue_go
(
const
Base
*
b
)
{
b
->
dispatch
();
}
void
init_issues
(
py
::
module
&
m
)
{
py
::
module
m2
=
m
.
def_submodule
(
"issues"
);
...
...
@@ -34,12 +20,22 @@ void init_issues(py::module &m) {
m2
.
def
(
"print_char"
,
[](
char
c
)
{
std
::
cout
<<
c
<<
std
::
endl
;
});
// #159: virtual function dispatch has problems with similar-named functions
struct
Base
{
virtual
void
dispatch
(
void
)
const
=
0
;
};
struct
DispatchIssue
:
Base
{
virtual
void
dispatch
(
void
)
const
{
PYBIND11_OVERLOAD_PURE
(
void
,
Base
,
dispatch
,
/* no arguments */
);
}
};
py
::
class_
<
DispatchIssue
>
base
(
m2
,
"DispatchIssue"
);
base
.
alias
<
Base
>
()
.
def
(
py
::
init
<>
())
.
def
(
"dispatch"
,
&
Base
::
dispatch
);
m2
.
def
(
"dispatch_issue_go"
,
&
dispatch_issue_go
);
m2
.
def
(
"dispatch_issue_go"
,
[](
const
Base
*
b
)
{
b
->
dispatch
();
});
struct
Placeholder
{
int
i
;
Placeholder
(
int
i
)
:
i
(
i
)
{
}
};
py
::
class_
<
Placeholder
>
(
m2
,
"Placeholder"
)
.
def
(
py
::
init
<
int
>
())
...
...
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