/*************************************************************************** * Copyright (c) Johan Mabille, Sylvain Corlay and Wolf Vollprecht * * Copyright (c) QuantStack * * * * Distributed under the terms of the BSD 3-Clause License. * * * * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ #ifndef XTENSOR_UTILS_HPP #define XTENSOR_UTILS_HPP #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "xtensor_config.hpp" #if (_MSC_VER >= 1910) #define NOEXCEPT(T) #else #define NOEXCEPT(T) noexcept(T) #endif namespace xt { /**************** * declarations * ****************/ template struct remove_class; /*template void for_each(F&& f, std::tuple& t) noexcept(implementation_dependent);*/ /*template R accumulate(F&& f, R init, const std::tuple& t) noexcept(implementation_dependent);*/ template constexpr decltype(auto) argument(Args&&... args) noexcept; template R apply(std::size_t index, F&& func, const std::tuple& s) NOEXCEPT(noexcept(func(std::get<0>(s)))); template void nested_copy(T&& iter, const S& s); template void nested_copy(T&& iter, std::initializer_list s); template bool resize_container(C& c, typename C::size_type size); template bool resize_container(std::array& a, typename std::array::size_type size); template class fixed_shape; template bool resize_container(fixed_shape& a, std::size_t size); template struct rebind_container; template using rebind_container_t = typename rebind_container::type; std::size_t normalize_axis(std::size_t dim, std::ptrdiff_t axis); // gcc 4.9 is affected by C++14 defect CGW 1558 // see http://open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#1558 template struct make_void { using type = void; }; template using void_t = typename make_void::type; // This is used for non existent types (e.g. storage for some expressions // like generators) struct invalid_type { }; template struct make_invalid_type { using type = invalid_type; }; template using disable_integral_t = std::enable_if_t::value, R>; /******************************** * meta identity implementation * ********************************/ template struct meta_identity { using type = T; }; /*************************************** * is_specialization_of implementation * ***************************************/ template