@@ -124,8 +124,9 @@ class cpp_function : public function {
124
124
typename = detail::enable_if_t <detail::is_lambda<Func>::value>>
125
125
// NOLINTNEXTLINE(google-explicit-constructor)
126
126
cpp_function (Func &&f, Extra &&...extra ) {
127
- initialize (
128
- std::forward<Func>(f), (detail::function_signature_t <Func> *) nullptr , std::forward<Extra>(extra)...);
127
+ initialize (std::forward<Func>(f),
128
+ (detail::function_signature_t <Func> *) nullptr ,
129
+ std::forward<Extra>(extra)...);
129
130
}
130
131
131
132
// / Construct a cpp_function from a class method (non-const, no ref-qualifier)
@@ -191,7 +192,7 @@ class cpp_function : public function {
191
192
192
193
// / Special internal constructor for functors, lambda functions, etc.
193
194
template <typename Func, typename Return, typename ... Args, typename ... Extra>
194
- void initialize (Func &&f, Return (*)(Args...), Extra &&... extra) {
195
+ void initialize (Func &&f, Return (*)(Args...), Extra &&...extra ) {
195
196
using namespace detail ;
196
197
struct capture {
197
198
remove_reference_t <Func> f;
@@ -1728,7 +1729,11 @@ class class_ : public detail::generic_type {
1728
1729
" def_readwrite() requires a class member (or base class member)" );
1729
1730
cpp_function fget ([pm](const type &c) -> const D & { return c.*pm; }, is_method (*this )),
1730
1731
fset ([pm](type &c, const D &value) { c.*pm = value; }, is_method (*this ));
1731
- def_property (name, fget, fset, return_value_policy::reference_internal, std::forward<Extra>(extra)...);
1732
+ def_property (name,
1733
+ fget,
1734
+ fset,
1735
+ return_value_policy::reference_internal,
1736
+ std::forward<Extra>(extra)...);
1732
1737
return *this ;
1733
1738
}
1734
1739
@@ -1737,22 +1742,25 @@ class class_ : public detail::generic_type {
1737
1742
static_assert (std::is_same<C, type>::value || std::is_base_of<C, type>::value,
1738
1743
" def_readonly() requires a class member (or base class member)" );
1739
1744
cpp_function fget ([pm](const type &c) -> const D & { return c.*pm; }, is_method (*this ));
1740
- def_property_readonly (name, fget, return_value_policy::reference_internal, std::forward<Extra>(extra)...);
1745
+ def_property_readonly (
1746
+ name, fget, return_value_policy::reference_internal, std::forward<Extra>(extra)...);
1741
1747
return *this ;
1742
1748
}
1743
1749
1744
1750
template <typename D, typename ... Extra>
1745
1751
class_ &def_readwrite_static (const char *name, D *pm, Extra &&...extra) {
1746
1752
cpp_function fget ([pm](const object &) -> const D & { return *pm; }, scope (*this )),
1747
1753
fset ([pm](const object &, const D &value) { *pm = value; }, scope (*this ));
1748
- def_property_static (name, fget, fset, return_value_policy::reference, std::forward<Extra>(extra)...);
1754
+ def_property_static (
1755
+ name, fget, fset, return_value_policy::reference, std::forward<Extra>(extra)...);
1749
1756
return *this ;
1750
1757
}
1751
1758
1752
1759
template <typename D, typename ... Extra>
1753
1760
class_ &def_readonly_static (const char *name, const D *pm, Extra &&...extra) {
1754
1761
cpp_function fget ([pm](const object &) -> const D & { return *pm; }, scope (*this ));
1755
- def_property_readonly_static (name, fget, return_value_policy::reference, std::forward<Extra>(extra)...);
1762
+ def_property_readonly_static (
1763
+ name, fget, return_value_policy::reference, std::forward<Extra>(extra)...);
1756
1764
return *this ;
1757
1765
}
1758
1766
@@ -1767,33 +1775,34 @@ class class_ : public detail::generic_type {
1767
1775
1768
1776
// / Uses cpp_function's return_value_policy by default
1769
1777
template <typename ... Extra>
1770
- class_ &
1771
- def_property_readonly (const char *name, const cpp_function &fget, Extra &&...extra) {
1778
+ class_ &def_property_readonly (const char *name, const cpp_function &fget, Extra &&...extra) {
1772
1779
return def_property (name, fget, nullptr , std::forward<Extra>(extra)...);
1773
1780
}
1774
1781
1775
1782
// / Uses return_value_policy::reference by default
1776
1783
template <typename Getter, typename ... Extra>
1777
- class_ &
1778
- def_property_readonly_static (const char *name, const Getter &fget, Extra &&...extra) {
1779
- return def_property_readonly_static (
1780
- name, cpp_function (fget), return_value_policy::reference, std::forward<Extra>(extra)...);
1784
+ class_ &def_property_readonly_static (const char *name, const Getter &fget, Extra &&...extra) {
1785
+ return def_property_readonly_static (name,
1786
+ cpp_function (fget),
1787
+ return_value_policy::reference,
1788
+ std::forward<Extra>(extra)...);
1781
1789
}
1782
1790
1783
1791
// / Uses cpp_function's return_value_policy by default
1784
1792
template <typename ... Extra>
1785
- class_ &def_property_readonly_static (const char *name,
1786
- const cpp_function &fget,
1787
- Extra &&...extra) {
1793
+ class_ &
1794
+ def_property_readonly_static (const char *name, const cpp_function &fget, Extra &&...extra) {
1788
1795
return def_property_static (name, fget, nullptr , std::forward<Extra>(extra)...);
1789
1796
}
1790
1797
1791
1798
// / Uses return_value_policy::reference_internal by default
1792
1799
template <typename Getter, typename Setter, typename ... Extra>
1793
1800
class_ &
1794
1801
def_property (const char *name, const Getter &fget, const Setter &fset, Extra &&...extra) {
1795
- return def_property (
1796
- name, fget, cpp_function (method_adaptor<type>(fset), is_setter ()), std::forward<Extra>(extra)...);
1802
+ return def_property (name,
1803
+ fget,
1804
+ cpp_function (method_adaptor<type>(fset), is_setter ()),
1805
+ std::forward<Extra>(extra)...);
1797
1806
}
1798
1807
template <typename Getter, typename ... Extra>
1799
1808
class_ &def_property (const char *name,
@@ -1813,7 +1822,8 @@ class class_ : public detail::generic_type {
1813
1822
const cpp_function &fget,
1814
1823
const cpp_function &fset,
1815
1824
Extra &&...extra) {
1816
- return def_property_static (name, fget, fset, is_method (*this ), std::forward<Extra>(extra)...);
1825
+ return def_property_static (
1826
+ name, fget, fset, is_method (*this ), std::forward<Extra>(extra)...);
1817
1827
}
1818
1828
1819
1829
// / Uses return_value_policy::reference by default
@@ -1822,8 +1832,11 @@ class class_ : public detail::generic_type {
1822
1832
const Getter &fget,
1823
1833
const cpp_function &fset,
1824
1834
Extra &&...extra) {
1825
- return def_property_static (
1826
- name, cpp_function (fget), fset, return_value_policy::reference, std::forward<Extra>(extra)...);
1835
+ return def_property_static (name,
1836
+ cpp_function (fget),
1837
+ fset,
1838
+ return_value_policy::reference,
1839
+ std::forward<Extra>(extra)...);
1827
1840
}
1828
1841
1829
1842
// / Uses cpp_function's return_value_policy by default
0 commit comments