diff --git a/include/array_view.h b/include/array_view.h index 0ca7397..1ca186b 100644 --- a/include/array_view.h +++ b/include/array_view.h @@ -70,7 +70,7 @@ namespace details template struct SizeTypeTraits { - static const size_t max_value = std::is_signed::value ? static_cast::type>(-1) / 2 : static_cast(-1); + static const size_t max_value = std::is_signed::value ? static_cast>(-1) / 2 : static_cast(-1); }; @@ -84,9 +84,9 @@ namespace details template friend class coordinate_facade; public: - using value_type = typename std::remove_reference::type; - using reference = typename std::add_lvalue_reference::type; - using const_reference = typename std::add_lvalue_reference::type>::type; + using value_type = std::remove_reference_t; + using reference = std::add_lvalue_reference_t; + using const_reference = std::add_lvalue_reference_t>; static const size_t rank = Rank; _CONSTEXPR coordinate_facade() _NOEXCEPT { @@ -324,10 +324,10 @@ class index<1, ValueType> friend class index; public: static const size_t rank = 1; - using reference = ValueType&; - using const_reference = const ValueType&; + using value_type = std::remove_reference_t; + using reference = std::add_lvalue_reference_t; + using const_reference = std::add_lvalue_reference_t>; using size_type = ValueType; - using value_type = ValueType; _CONSTEXPR index() _NOEXCEPT : value(0) { @@ -1335,8 +1335,8 @@ namespace details auto extents = bnd.index_bounds(); typename Bounds::index_type stride; stride[Bounds::rank - 1] = 1; - for (int i = Bounds::rank - 2; i >= 0; --i) - stride[i] = stride[i + 1] * extents[i + 1]; + for (size_t i = Bounds::rank - 1; i > 0; --i) + stride[i - 1] = stride[i] * extents[i]; return stride; } @@ -1366,9 +1366,9 @@ public: using bounds_type = BoundsType; using size_type = typename bounds_type::size_type; using index_type = typename bounds_type::index_type; - using value_type = typename std::remove_reference::type; - using pointer = typename std::add_pointer::type; - using reference = typename std::add_lvalue_reference::type; + using value_type = std::remove_reference_t; + using pointer = std::add_pointer_t; + using reference = std::add_lvalue_reference_t; using iterator = std::conditional_t::value, contiguous_array_view_iterator, general_array_view_iterator>; using const_iterator = std::conditional_t::value, contiguous_array_view_iterator>, general_array_view_iterator>>; using reverse_iterator = std::reverse_iterator; @@ -1553,7 +1553,7 @@ namespace details }; template - struct ArrayViewTypeTraits::type> + struct ArrayViewTypeTraits::value>> { using value_type = typename Traits::array_view_traits::value_type; using size_type = typename Traits::array_view_traits::size_type; @@ -1562,10 +1562,10 @@ namespace details template struct ArrayViewArrayTraits { using type = array_view; - using value_type = T; + using value_type = std::remove_reference_t; using bounds_type = static_bounds; - using pointer = T*; - using reference = T&; + using pointer = std::add_pointer_t; + using reference = std::add_lvalue_reference_t; }; template struct ArrayViewArrayTraits : ArrayViewArrayTraits {}; @@ -1983,7 +1983,7 @@ public: // convert from bytes template - strided_array_view::value, OtherValueType>::type, rank> as_strided_array_view() const + strided_array_view::value, OtherValueType>, rank> as_strided_array_view() const { static_assert((sizeof(OtherValueType) >= sizeof(value_type)) && (sizeof(OtherValueType) % sizeof(value_type) == 0), "OtherValueType should have a size to contain a multiple of ValueTypes"); auto d = sizeof(OtherValueType) / sizeof(value_type); diff --git a/include/string_view.h b/include/string_view.h index e683c7a..5af480d 100644 --- a/include/string_view.h +++ b/include/string_view.h @@ -128,7 +128,7 @@ template basic_string_view ensure_z(T(&sz)[N]) { return ensure_z(&sz[0], N); } template -basic_string_view::type, dynamic_range> ensure_z(Cont& cont) +basic_string_view, dynamic_range> ensure_z(Cont& cont) { return ensure_z(cont.data(), cont.length()); } @@ -137,7 +137,7 @@ basic_string_view::type, dy // to_string() allow (explicit) conversions from string_view to string // template -std::basic_string::type> to_string(const basic_string_view& view) +std::basic_string> to_string(const basic_string_view& view) { return{ view.data(), view.length() }; }