Skip to content

Commit 422a58f

Browse files
authored
Merge pull request #2836 from JohanMabille/apply_cv
Replaced apply_cv with xtl::apply_cv and deleted duplicated code
2 parents f31d415 + 73d89dd commit 422a58f

File tree

3 files changed

+4
-72
lines changed

3 files changed

+4
-72
lines changed

include/xtensor/utils/xutils.hpp

-68
Original file line numberDiff line numberDiff line change
@@ -533,74 +533,6 @@ namespace xt
533533
return std::get<I>(static_cast<const std::tuple<Args...>&>(v));
534534
}
535535

536-
/***************************
537-
* apply_cv implementation *
538-
***************************/
539-
540-
namespace detail
541-
{
542-
template <
543-
class T,
544-
class U,
545-
bool = std::is_const<std::remove_reference_t<T>>::value,
546-
bool = std::is_volatile<std::remove_reference_t<T>>::value>
547-
struct apply_cv_impl
548-
{
549-
using type = U;
550-
};
551-
552-
template <class T, class U>
553-
struct apply_cv_impl<T, U, true, false>
554-
{
555-
using type = const U;
556-
};
557-
558-
template <class T, class U>
559-
struct apply_cv_impl<T, U, false, true>
560-
{
561-
using type = volatile U;
562-
};
563-
564-
template <class T, class U>
565-
struct apply_cv_impl<T, U, true, true>
566-
{
567-
using type = const volatile U;
568-
};
569-
570-
template <class T, class U>
571-
struct apply_cv_impl<T&, U, false, false>
572-
{
573-
using type = U&;
574-
};
575-
576-
template <class T, class U>
577-
struct apply_cv_impl<T&, U, true, false>
578-
{
579-
using type = const U&;
580-
};
581-
582-
template <class T, class U>
583-
struct apply_cv_impl<T&, U, false, true>
584-
{
585-
using type = volatile U&;
586-
};
587-
588-
template <class T, class U>
589-
struct apply_cv_impl<T&, U, true, true>
590-
{
591-
using type = const volatile U&;
592-
};
593-
}
594-
595-
template <class T, class U>
596-
struct apply_cv
597-
{
598-
using type = typename detail::apply_cv_impl<T, U>::type;
599-
};
600-
601-
template <class T, class U>
602-
using apply_cv_t = typename apply_cv<T, U>::type;
603-
604536
/**************************
605537
* to_array implementation *
606538
***************************/

include/xtensor/views/xaxis_iterator.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ namespace xt
4141
using difference_type = typename xexpression_type::difference_type;
4242
using shape_type = typename xexpression_type::shape_type;
4343
using value_type = xstrided_view<CT, shape_type>;
44-
using reference = std::remove_reference_t<apply_cv_t<CT, value_type>>;
45-
using pointer = xtl::xclosure_pointer<std::remove_reference_t<apply_cv_t<CT, value_type>>>;
44+
using reference = std::remove_reference_t<xtl::apply_cv_t<CT, value_type>>;
45+
using pointer = xtl::xclosure_pointer<std::remove_reference_t<xtl::apply_cv_t<CT, value_type>>>;
4646

4747
using iterator_category = std::forward_iterator_tag;
4848

include/xtensor/views/xaxis_slice_iterator.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ namespace xt
3737
using shape_type = typename xexpression_type::shape_type;
3838
using strides_type = typename xexpression_type::strides_type;
3939
using value_type = xstrided_view<CT, shape_type>;
40-
using reference = std::remove_reference_t<apply_cv_t<CT, value_type>>;
41-
using pointer = xtl::xclosure_pointer<std::remove_reference_t<apply_cv_t<CT, value_type>>>;
40+
using reference = std::remove_reference_t<xtl::apply_cv_t<CT, value_type>>;
41+
using pointer = xtl::xclosure_pointer<std::remove_reference_t<xtl::apply_cv_t<CT, value_type>>>;
4242

4343
using iterator_category = std::forward_iterator_tag;
4444

0 commit comments

Comments
 (0)