Skip to content

Commit 2e9423a

Browse files
committed
Making use of all_of, none_of as suggested by @Skylion007
1 parent a281ef8 commit 2e9423a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

include/pybind11/pybind11.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,9 +1415,9 @@ template <typename T, typename D>
14151415
struct xetter_cpp_function<
14161416
T,
14171417
D,
1418-
detail::enable_if_t<detail::type_uses_smart_holder_type_caster<T>::value
1419-
&& detail::type_uses_smart_holder_type_caster<D>::value
1420-
&& std::is_pointer<D>::value>> {
1418+
detail::enable_if_t<detail::all_of<detail::type_uses_smart_holder_type_caster<T>,
1419+
detail::type_uses_smart_holder_type_caster<D>,
1420+
std::is_pointer<D>>::value>> {
14211421

14221422
using drp = typename std::remove_pointer<D>::type;
14231423

@@ -1450,11 +1450,11 @@ template <typename T, typename D>
14501450
struct xetter_cpp_function<
14511451
T,
14521452
D,
1453-
detail::enable_if_t<detail::type_uses_smart_holder_type_caster<T>::value
1454-
&& detail::type_uses_smart_holder_type_caster<D>::value
1455-
&& !std::is_pointer<D>::value //
1456-
&& !detail::is_std_unique_ptr<D>::value //
1457-
&& !detail::is_std_shared_ptr<D>::value>> {
1453+
detail::enable_if_t<detail::all_of<detail::type_uses_smart_holder_type_caster<T>,
1454+
detail::type_uses_smart_holder_type_caster<D>,
1455+
detail::none_of<std::is_pointer<D>,
1456+
detail::is_std_unique_ptr<D>,
1457+
detail::is_std_shared_ptr<D>>>::value>> {
14581458

14591459
template <typename PM, must_be_member_function_pointer<PM> = 0>
14601460
static cpp_function readonly(PM pm, const handle &hdl) {
@@ -1491,10 +1491,10 @@ template <typename T, typename D>
14911491
struct xetter_cpp_function<
14921492
T,
14931493
D,
1494-
detail::enable_if_t<
1495-
detail::type_uses_smart_holder_type_caster<T>::value //
1496-
&& detail::is_std_unique_ptr<D>::value
1497-
&& detail::type_uses_smart_holder_type_caster<typename D::element_type>::value>> {
1494+
detail::enable_if_t<detail::all_of<
1495+
detail::type_uses_smart_holder_type_caster<T>,
1496+
detail::is_std_unique_ptr<D>,
1497+
detail::type_uses_smart_holder_type_caster<typename D::element_type>>::value>> {
14981498

14991499
template <typename PM, must_be_member_function_pointer<PM> = 0>
15001500
static cpp_function readonly(PM, const handle &) {

0 commit comments

Comments
 (0)