@@ -1437,49 +1437,6 @@ namespace xt
14371437#define XTENSOR_CONST const
14381438#endif
14391439
1440- #if defined(__GNUC__) && __GNUC__ < 5 && !defined(__clang__)
1441- #define GCC4_FALLBACK
1442-
1443- namespace const_array_detail
1444- {
1445- template <class T , std::size_t N>
1446- struct array_traits
1447- {
1448- using storage_type = T[N];
1449-
1450- static constexpr T& ref (const storage_type& t, std::size_t n) noexcept
1451- {
1452- return const_cast <T&>(t[n]);
1453- }
1454-
1455- static constexpr T* ptr (const storage_type& t) noexcept
1456- {
1457- return const_cast <T*>(t);
1458- }
1459- };
1460-
1461- template <class T >
1462- struct array_traits <T, 0 >
1463- {
1464- struct empty
1465- {
1466- };
1467-
1468- using storage_type = empty;
1469-
1470- static constexpr T& ref (const storage_type& /* t*/ , std::size_t /* n*/ ) noexcept
1471- {
1472- return *static_cast <T*>(nullptr );
1473- }
1474-
1475- static constexpr T* ptr (const storage_type& /* t*/ ) noexcept
1476- {
1477- return nullptr ;
1478- }
1479- };
1480- }
1481- #endif
1482-
14831440 /* *
14841441 * A std::array like class with all member function (except reverse iterators)
14851442 * as constexpr. The data is immutable once set.
@@ -1502,11 +1459,7 @@ namespace xt
15021459
15031460 constexpr const_reference operator [](std::size_t idx) const
15041461 {
1505- #ifdef GCC4_FALLBACK
1506- return const_array_detail::array_traits<T, N>::ref (m_data, idx);
1507- #else
15081462 return m_data[idx];
1509- #endif
15101463 }
15111464
15121465 constexpr const_iterator begin () const noexcept
@@ -1552,30 +1505,17 @@ namespace xt
15521505
15531506 constexpr const_pointer data () const noexcept
15541507 {
1555- #ifdef GCC4_FALLBACK
1556- return const_array_detail::array_traits<T, N>::ptr (m_data);
1557- #else
15581508 return m_data;
1559- #endif
15601509 }
15611510
15621511 constexpr const_reference front () const noexcept
15631512 {
1564- #ifdef GCC4_FALLBACK
1565- return const_array_detail::array_traits<T, N>::ref (m_data, 0 );
1566- #else
15671513 return m_data[0 ];
1568- #endif
15691514 }
15701515
15711516 constexpr const_reference back () const noexcept
15721517 {
1573- #ifdef GCC4_FALLBACK
1574- return N ? const_array_detail::array_traits<T, N>::ref (m_data, N - 1 )
1575- : const_array_detail::array_traits<T, N>::ref (m_data, 0 );
1576- #else
15771518 return m_data[size () - 1 ];
1578- #endif
15791519 }
15801520
15811521 constexpr bool empty () const noexcept
@@ -1588,14 +1528,9 @@ namespace xt
15881528 return N;
15891529 }
15901530
1591- #ifdef GCC4_FALLBACK
1592- XTENSOR_CONST typename const_array_detail::array_traits<T, N>::storage_type m_data;
1593- #else
15941531 XTENSOR_CONST T m_data[N > 0 ? N : 1 ];
1595- #endif
15961532 };
15971533
1598- #undef GCC4_FALLBACK
15991534
16001535 template <class T , std::size_t N>
16011536 inline bool operator ==(const const_array<T, N>& lhs, const const_array<T, N>& rhs)
0 commit comments