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
0b489588
"vscode:/vscode.git/clone" did not exist on "ee2e5a5086d02eda96e6cfcf8e15d8fbcd2af57c"
Commit
0b489588
authored
Mar 25, 2016
by
Wenzel Jakob
Browse files
improve default parameters for properties
parent
84ec78fe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
15 deletions
+11
-15
include/pybind11/pybind11.h
include/pybind11/pybind11.h
+11
-15
No files found.
include/pybind11/pybind11.h
View file @
0b489588
...
@@ -798,34 +798,31 @@ public:
...
@@ -798,34 +798,31 @@ public:
template
<
typename
C
,
typename
D
,
typename
...
Extra
>
template
<
typename
C
,
typename
D
,
typename
...
Extra
>
class_
&
def_readwrite
(
const
char
*
name
,
D
C
::*
pm
,
const
Extra
&
...
extra
)
{
class_
&
def_readwrite
(
const
char
*
name
,
D
C
::*
pm
,
const
Extra
&
...
extra
)
{
cpp_function
fget
([
pm
](
const
C
&
c
)
->
const
D
&
{
return
c
.
*
pm
;
},
cpp_function
fget
([
pm
](
const
C
&
c
)
->
const
D
&
{
return
c
.
*
pm
;
},
is_method
(
*
this
)),
is_method
(
*
this
),
extra
...),
fset
([
pm
](
C
&
c
,
const
D
&
value
)
{
c
.
*
pm
=
value
;
},
is_method
(
*
this
));
fset
([
pm
](
C
&
c
,
const
D
&
value
)
{
c
.
*
pm
=
value
;
},
def_property
(
name
,
fget
,
fset
,
return_value_policy
::
reference_internal
,
extra
...);
is_method
(
*
this
),
extra
...);
def_property
(
name
,
fget
,
fset
);
return
*
this
;
return
*
this
;
}
}
template
<
typename
C
,
typename
D
,
typename
...
Extra
>
template
<
typename
C
,
typename
D
,
typename
...
Extra
>
class_
&
def_readonly
(
const
char
*
name
,
const
D
C
::*
pm
,
const
Extra
&
...
extra
)
{
class_
&
def_readonly
(
const
char
*
name
,
const
D
C
::*
pm
,
const
Extra
&
...
extra
)
{
cpp_function
fget
([
pm
](
const
C
&
c
)
->
const
D
&
{
return
c
.
*
pm
;
},
cpp_function
fget
([
pm
](
const
C
&
c
)
->
const
D
&
{
return
c
.
*
pm
;
},
is_method
(
*
this
));
is_method
(
*
this
),
extra
...);
def_property_readonly
(
name
,
fget
,
return_value_policy
::
reference_internal
,
extra
...);
def_property_readonly
(
name
,
fget
);
return
*
this
;
return
*
this
;
}
}
template
<
typename
D
,
typename
...
Extra
>
template
<
typename
D
,
typename
...
Extra
>
class_
&
def_readwrite_static
(
const
char
*
name
,
D
*
pm
,
const
Extra
&
...
extra
)
{
class_
&
def_readwrite_static
(
const
char
*
name
,
D
*
pm
,
const
Extra
&
...
extra
)
{
cpp_function
fget
([
pm
](
object
)
->
const
D
&
{
return
*
pm
;
},
scope
(
*
this
)
,
extra
...
),
cpp_function
fget
([
pm
](
object
)
->
const
D
&
{
return
*
pm
;
},
scope
(
*
this
)),
fset
([
pm
](
object
,
const
D
&
value
)
{
*
pm
=
value
;
},
scope
(
*
this
)
,
extra
...
);
fset
([
pm
](
object
,
const
D
&
value
)
{
*
pm
=
value
;
},
scope
(
*
this
));
def_property_static
(
name
,
fget
,
fset
);
def_property_static
(
name
,
fget
,
fset
,
return_value_policy
::
reference
,
extra
...
);
return
*
this
;
return
*
this
;
}
}
template
<
typename
D
,
typename
...
Extra
>
template
<
typename
D
,
typename
...
Extra
>
class_
&
def_readonly_static
(
const
char
*
name
,
const
D
*
pm
,
const
Extra
&
...
extra
)
{
class_
&
def_readonly_static
(
const
char
*
name
,
const
D
*
pm
,
const
Extra
&
...
extra
)
{
cpp_function
fget
([
pm
](
object
)
->
const
D
&
{
return
*
pm
;
},
scope
(
*
this
)
,
extra
...
);
cpp_function
fget
([
pm
](
object
)
->
const
D
&
{
return
*
pm
;
},
scope
(
*
this
));
def_property_readonly_static
(
name
,
fget
);
def_property_readonly_static
(
name
,
fget
,
return_value_policy
::
reference
,
extra
...
);
return
*
this
;
return
*
this
;
}
}
...
@@ -843,8 +840,7 @@ public:
...
@@ -843,8 +840,7 @@ public:
template
<
typename
...
Extra
>
template
<
typename
...
Extra
>
class_
&
def_property
(
const
char
*
name
,
const
cpp_function
&
fget
,
const
cpp_function
&
fset
,
const
Extra
&
...
extra
)
{
class_
&
def_property
(
const
char
*
name
,
const
cpp_function
&
fget
,
const
cpp_function
&
fset
,
const
Extra
&
...
extra
)
{
return
def_property_static
(
name
,
fget
,
fset
,
is_method
(
*
this
),
return
def_property_static
(
name
,
fget
,
fset
,
is_method
(
*
this
),
extra
...);
return_value_policy
::
reference_internal
,
extra
...);
}
}
template
<
typename
...
Extra
>
template
<
typename
...
Extra
>
...
...
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