xtensor icon indicating copy to clipboard operation
xtensor copied to clipboard

Ambiguous to_array function call in xindex_view.hpp due to new function in c++20 std <array>

Open WenyinWei opened this issue 4 years ago • 1 comments

If forced to follow C++20 standard by -std=c++20, g++ and clang++ both complain about ambiguous (misleading overload) of to_array(indices) at xtensor/xindex_view.hpp:761:46.

template <class E, std::size_t L>
inline auto index_view(E&& e, const xindex (&indices)[L]) noexcept
{
    using view_type = xindex_view<xclosure_t<E>, std::array<xindex, L>>;
    return view_type(std::forward<E>(e), to_array(indices));
}

The problem comes from a new to_array function in std <array> header, which is /usr/include/c++/11/array:406:5 for g++-11 on Ubuntu.

WenyinWei avatar Aug 26 '21 08:08 WenyinWei

The problem could be easily fixed by prepending namespace xt:: before to_array

WenyinWei avatar Aug 26 '21 08:08 WenyinWei