From 73d89dddf233665816779913474e1951ec94f61f Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Mon, 31 Mar 2025 15:52:44 +0200 Subject: [PATCH] Replaced apply_cv with xtl::apply_cv and deleted duplicated code --- include/xtensor/utils/xutils.hpp | 68 ------------------- include/xtensor/views/xaxis_iterator.hpp | 4 +- .../xtensor/views/xaxis_slice_iterator.hpp | 4 +- 3 files changed, 4 insertions(+), 72 deletions(-) diff --git a/include/xtensor/utils/xutils.hpp b/include/xtensor/utils/xutils.hpp index 7c4989506..71b653d44 100644 --- a/include/xtensor/utils/xutils.hpp +++ b/include/xtensor/utils/xutils.hpp @@ -533,74 +533,6 @@ namespace xt return std::get(static_cast&>(v)); } - /*************************** - * apply_cv implementation * - ***************************/ - - namespace detail - { - template < - class T, - class U, - bool = std::is_const>::value, - bool = std::is_volatile>::value> - struct apply_cv_impl - { - using type = U; - }; - - template - struct apply_cv_impl - { - using type = const U; - }; - - template - struct apply_cv_impl - { - using type = volatile U; - }; - - template - struct apply_cv_impl - { - using type = const volatile U; - }; - - template - struct apply_cv_impl - { - using type = U&; - }; - - template - struct apply_cv_impl - { - using type = const U&; - }; - - template - struct apply_cv_impl - { - using type = volatile U&; - }; - - template - struct apply_cv_impl - { - using type = const volatile U&; - }; - } - - template - struct apply_cv - { - using type = typename detail::apply_cv_impl::type; - }; - - template - using apply_cv_t = typename apply_cv::type; - /************************** * to_array implementation * ***************************/ diff --git a/include/xtensor/views/xaxis_iterator.hpp b/include/xtensor/views/xaxis_iterator.hpp index 64bae99cb..62489b08f 100644 --- a/include/xtensor/views/xaxis_iterator.hpp +++ b/include/xtensor/views/xaxis_iterator.hpp @@ -41,8 +41,8 @@ namespace xt using difference_type = typename xexpression_type::difference_type; using shape_type = typename xexpression_type::shape_type; using value_type = xstrided_view; - using reference = std::remove_reference_t>; - using pointer = xtl::xclosure_pointer>>; + using reference = std::remove_reference_t>; + using pointer = xtl::xclosure_pointer>>; using iterator_category = std::forward_iterator_tag; diff --git a/include/xtensor/views/xaxis_slice_iterator.hpp b/include/xtensor/views/xaxis_slice_iterator.hpp index 330fd97e9..108955595 100644 --- a/include/xtensor/views/xaxis_slice_iterator.hpp +++ b/include/xtensor/views/xaxis_slice_iterator.hpp @@ -37,8 +37,8 @@ namespace xt using shape_type = typename xexpression_type::shape_type; using strides_type = typename xexpression_type::strides_type; using value_type = xstrided_view; - using reference = std::remove_reference_t>; - using pointer = xtl::xclosure_pointer>>; + using reference = std::remove_reference_t>; + using pointer = xtl::xclosure_pointer>>; using iterator_category = std::forward_iterator_tag;