Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# The full license is in the file LICENSE, distributed with this software. #
############################################################################

cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.29)
project(xtensor CXX)

set(XTENSOR_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
Expand All @@ -29,7 +29,7 @@ message(STATUS "Building xtensor v${${PROJECT_NAME}_VERSION}")
# Dependencies
# ============

set(xtl_REQUIRED_VERSION 0.7.5)
set(xtl_REQUIRED_VERSION 0.8.0)
if(TARGET xtl)
set(xtl_VERSION ${XTL_VERSION_MAJOR}.${XTL_VERSION_MINOR}.${XTL_VERSION_PATCH})
# Note: This is not SEMVER compatible comparison
Expand Down Expand Up @@ -194,7 +194,7 @@ target_include_directories(xtensor INTERFACE
$<BUILD_INTERFACE:${XTENSOR_INCLUDE_DIR}>
$<INSTALL_INTERFACE:include>)

target_compile_features(xtensor INTERFACE cxx_std_14)
target_compile_features(xtensor INTERFACE cxx_std_17)

target_link_libraries(xtensor INTERFACE xtl)

Expand All @@ -205,8 +205,6 @@ OPTION(BUILD_TESTS "xtensor test suite" OFF)
OPTION(BUILD_BENCHMARK "xtensor benchmark" OFF)
OPTION(DOWNLOAD_GBENCHMARK "download google benchmark and build from source" ON)
OPTION(DEFAULT_COLUMN_MAJOR "set default layout to column major" OFF)
OPTION(DISABLE_VS2017 "disables the compilation of some test with Visual Studio 2017" OFF)
OPTION(CPP17 "enables C++17" OFF)
OPTION(CPP20 "enables C++20 (experimental)" OFF)
OPTION(XTENSOR_DISABLE_EXCEPTIONS "Disable C++ exceptions" OFF)
OPTION(DISABLE_MSVC_ITERATOR_CHECK "Disable the MVSC iterator check" ON)
Expand Down
2 changes: 1 addition & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
dependencies:
- cmake
- xtl=0.7.5
- xtl=0.8.0
- xsimd=13.2.0
- nlohmann_json
- doctest
Expand Down
6 changes: 3 additions & 3 deletions include/xtensor/containers/xadapt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ namespace xt
using default_allocator_for_ptr_t = typename default_allocator_for_ptr<P>::type;

template <class T>
using not_an_array = xtl::negation<is_array<T>>;
using not_an_array = std::negation<is_array<T>>;

template <class T>
using not_a_pointer = xtl::negation<std::is_pointer<T>>;
using not_a_pointer = std::negation<std::is_pointer<T>>;

template <class T>
using not_a_layout = xtl::negation<std::is_same<layout_type, T>>;
using not_a_layout = std::negation<std::is_same<layout_type, T>>;
}

#ifndef IN_DOXYGEN
Expand Down
4 changes: 2 additions & 2 deletions include/xtensor/containers/xscalar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,13 @@ namespace xt
template <class... E>
struct all_xscalar
{
static constexpr bool value = xtl::conjunction<is_xscalar<std::decay_t<E>>...>::value;
static constexpr bool value = std::conjunction<is_xscalar<std::decay_t<E>>...>::value;
};
}

// Note: MSVC bug workaround. Cannot just define
// template <class... E>
// using all_xscalar = xtl::conjunction<is_xscalar<std::decay_t<E>>...>;
// using all_xscalar = std::conjunction<is_xscalar<std::decay_t<E>>...>;

template <class... E>
using all_xscalar = detail::all_xscalar<E...>;
Expand Down
70 changes: 32 additions & 38 deletions include/xtensor/core/xassign.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,18 +214,15 @@ namespace xt
template <class E1, class E2>
inline void assign_xexpression(xexpression<E1>& e1, const xexpression<E2>& e2)
{
xtl::mpl::static_if<has_assign_to<E1, E2>::value>(
[&](auto self)
{
self(e2).derived_cast().assign_to(e1);
},
/*else*/
[&](auto /*self*/)
{
using tag = xexpression_tag_t<E1, E2>;
xexpression_assigner<tag>::assign_xexpression(e1, e2);
}
);
if constexpr (has_assign_to<E1, E2>::value)
{
e2.derived_cast().assign_to(e1);
}
else
{
using tag = xexpression_tag_t<E1, E2>;
xexpression_assigner<tag>::assign_xexpression(e1, e2);
}
}

template <class E1, class E2>
Expand Down Expand Up @@ -320,7 +317,7 @@ namespace xt
template <class F, class... CT>
struct use_strided_loop<xfunction<F, CT...>>
{
static constexpr bool value = xtl::conjunction<use_strided_loop<std::decay_t<CT>>...>::value;
static constexpr bool value = std::conjunction<use_strided_loop<std::decay_t<CT>>...>::value;
};

/**
Expand Down Expand Up @@ -585,31 +582,28 @@ namespace xt
template <class E1, class F, class... CT>
inline bool xexpression_assigner<Tag>::resize(E1& e1, const xfunction<F, CT...>& e2)
{
return xtl::mpl::static_if<detail::is_fixed<typename xfunction<F, CT...>::shape_type>::value>(
[&](auto /*self*/)
{
/*
* If the shape of the xfunction is statically known, we can compute the broadcast triviality
* at compile time plus we can resize right away.
*/
// resize in case LHS is not a fixed size container. If it is, this is a NOP
e1.resize(typename xfunction<F, CT...>::shape_type{});
return detail::static_trivial_broadcast<
detail::is_fixed<typename xfunction<F, CT...>::shape_type>::value,
CT...>::value;
},
/* else */
[&](auto /*self*/)
{
using index_type = xindex_type_t<typename E1::shape_type>;
using size_type = typename E1::size_type;
size_type size = e2.dimension();
index_type shape = uninitialized_shape<index_type>(size);
bool trivial_broadcast = e2.broadcast_shape(shape, true);
e1.resize(std::move(shape));
return trivial_broadcast;
}
);
if constexpr (detail::is_fixed<typename xfunction<F, CT...>::shape_type>::value)
{
/*
* If the shape of the xfunction is statically known, we can compute the broadcast triviality
* at compile time plus we can resize right away.
*/
// resize in case LHS is not a fixed size container. If it is, this is a NOP
e1.resize(typename xfunction<F, CT...>::shape_type{});
return detail::static_trivial_broadcast<
detail::is_fixed<typename xfunction<F, CT...>::shape_type>::value,
CT...>::value;
}
else
{
using index_type = xindex_type_t<typename E1::shape_type>;
using size_type = typename E1::size_type;
size_type size = e2.dimension();
index_type shape = uninitialized_shape<index_type>(size);
bool trivial_broadcast = e2.broadcast_shape(shape, true);
e1.resize(std::move(shape));
return trivial_broadcast;
}
}

/***********************************
Expand Down
6 changes: 3 additions & 3 deletions include/xtensor/core/xexpression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ namespace xt

template <template <class> class B, class E, template <class> class F>
struct is_crtp_base_of_impl<B, F<E>>
: xtl::disjunction<std::is_base_of<B<E>, F<E>>, std::is_base_of<B<F<E>>, F<E>>>
: std::disjunction<std::is_base_of<B<E>, F<E>>, std::is_base_of<B<F<E>>, F<E>>>
{
};
}
Expand All @@ -186,7 +186,7 @@ namespace xt
using disable_xexpression = typename std::enable_if<!is_xexpression<E>::value, R>::type;

template <class... E>
using has_xexpression = xtl::disjunction<is_xexpression<E>...>;
using has_xexpression = std::disjunction<is_xexpression<E>...>;

template <class E>
using is_xsharable_expression = is_crtp_base_of<xsharable_expression, E>;
Expand Down Expand Up @@ -405,7 +405,7 @@ namespace xt

template <class... E>
struct xoptional_comparable
: xtl::conjunction<xtl::disjunction<is_xtensor_expression<E>, is_xoptional_expression<E>>...>
: std::conjunction<std::disjunction<is_xtensor_expression<E>, is_xoptional_expression<E>>...>
{
};

Expand Down
19 changes: 8 additions & 11 deletions include/xtensor/core/xfunction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace xt
{

template <bool... B>
using conjunction_c = xtl::conjunction<std::integral_constant<bool, B>...>;
using conjunction_c = std::conjunction<std::integral_constant<bool, B>...>;

/************************
* xfunction_cache_impl *
Expand Down Expand Up @@ -155,7 +155,7 @@ namespace xt
};

template <class T, class F, class... CT>
struct has_simd_interface<xfunction<F, CT...>, T> : xtl::conjunction<
struct has_simd_interface<xfunction<F, CT...>, T> : std::conjunction<
has_simd_type<T>,
has_simd_apply<F, xt_simd::simd_type<T>>,
has_simd_interface<std::decay_t<CT>, T>...>
Expand Down Expand Up @@ -589,16 +589,13 @@ namespace xt
template <class F, class... CT>
inline auto xfunction<F, CT...>::shape() const -> const inner_shape_type&
{
xtl::mpl::static_if<!detail::is_fixed<inner_shape_type>::value>(
[&](auto self)
if constexpr (!detail::is_fixed<inner_shape_type>::value)
{
if (!m_cache.is_initialized)
{
if (!m_cache.is_initialized)
{
self(this)->compute_cached_shape();
}
},
[](auto /*self*/) {}
);
compute_cached_shape();
}
}
return m_cache.shape;
}

Expand Down
Loading