diff --git a/include/xtensor/containers/xstorage.hpp b/include/xtensor/containers/xstorage.hpp index 426480805..af96f002b 100644 --- a/include/xtensor/containers/xstorage.hpp +++ b/include/xtensor/containers/xstorage.hpp @@ -1437,49 +1437,6 @@ namespace xt #define XTENSOR_CONST const #endif -#if defined(__GNUC__) && __GNUC__ < 5 && !defined(__clang__) -#define GCC4_FALLBACK - - namespace const_array_detail - { - template - struct array_traits - { - using storage_type = T[N]; - - static constexpr T& ref(const storage_type& t, std::size_t n) noexcept - { - return const_cast(t[n]); - } - - static constexpr T* ptr(const storage_type& t) noexcept - { - return const_cast(t); - } - }; - - template - struct array_traits - { - struct empty - { - }; - - using storage_type = empty; - - static constexpr T& ref(const storage_type& /*t*/, std::size_t /*n*/) noexcept - { - return *static_cast(nullptr); - } - - static constexpr T* ptr(const storage_type& /*t*/) noexcept - { - return nullptr; - } - }; - } -#endif - /** * A std::array like class with all member function (except reverse iterators) * as constexpr. The data is immutable once set. @@ -1502,11 +1459,7 @@ namespace xt constexpr const_reference operator[](std::size_t idx) const { -#ifdef GCC4_FALLBACK - return const_array_detail::array_traits::ref(m_data, idx); -#else return m_data[idx]; -#endif } constexpr const_iterator begin() const noexcept @@ -1552,30 +1505,17 @@ namespace xt constexpr const_pointer data() const noexcept { -#ifdef GCC4_FALLBACK - return const_array_detail::array_traits::ptr(m_data); -#else return m_data; -#endif } constexpr const_reference front() const noexcept { -#ifdef GCC4_FALLBACK - return const_array_detail::array_traits::ref(m_data, 0); -#else return m_data[0]; -#endif } constexpr const_reference back() const noexcept { -#ifdef GCC4_FALLBACK - return N ? const_array_detail::array_traits::ref(m_data, N - 1) - : const_array_detail::array_traits::ref(m_data, 0); -#else return m_data[size() - 1]; -#endif } constexpr bool empty() const noexcept @@ -1588,15 +1528,9 @@ namespace xt return N; } -#ifdef GCC4_FALLBACK - XTENSOR_CONST typename const_array_detail::array_traits::storage_type m_data; -#else XTENSOR_CONST T m_data[N > 0 ? N : 1]; -#endif }; -#undef GCC4_FALLBACK - template inline bool operator==(const const_array& lhs, const const_array& rhs) {