Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
139a082b
Commit
139a082b
authored
Mar 12, 2017
by
Jason Rhinelander
Browse files
Add static_assert failure for non-static def_static
Fixes #697
parent
2d965d43
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
include/pybind11/pybind11.h
include/pybind11/pybind11.h
+3
-1
No files found.
include/pybind11/pybind11.h
View file @
139a082b
...
@@ -929,7 +929,9 @@ public:
...
@@ -929,7 +929,9 @@ public:
}
}
template
<
typename
Func
,
typename
...
Extra
>
class_
&
template
<
typename
Func
,
typename
...
Extra
>
class_
&
def_static
(
const
char
*
name_
,
Func
f
,
const
Extra
&
...
extra
)
{
def_static
(
const
char
*
name_
,
Func
&&
f
,
const
Extra
&
...
extra
)
{
static_assert
(
!
std
::
is_member_function_pointer
<
Func
>::
value
,
"def_static(...) called with a non-static member function pointer"
);
cpp_function
cf
(
std
::
forward
<
Func
>
(
f
),
name
(
name_
),
scope
(
*
this
),
cpp_function
cf
(
std
::
forward
<
Func
>
(
f
),
name
(
name_
),
scope
(
*
this
),
sibling
(
getattr
(
*
this
,
name_
,
none
())),
extra
...);
sibling
(
getattr
(
*
this
,
name_
,
none
())),
extra
...);
attr
(
cf
.
name
())
=
cf
;
attr
(
cf
.
name
())
=
cf
;
...
...
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