diff --git a/include/array_view.h b/include/array_view.h index ddf6677..2ff693e 100644 --- a/include/array_view.h +++ b/include/array_view.h @@ -1643,7 +1643,7 @@ class array_view : public basic_array_view friend class array_view; using Base = basic_array_view::value_type, - static_bounds::size_type, FirstDimension, RestDimensions... >>; + static_bounds::size_type, FirstDimension, RestDimensions...>>; public: using typename Base::bounds_type; @@ -1679,17 +1679,17 @@ public: // from n-dimensions dynamic array (e.g. new int[m][4]) (precedence will be lower than the 1-dimension pointer) template , - typename Dummy = std::enable_if_t::value - && std::is_convertible::value >> - _CONSTEXPR array_view(T * const & data, size_type size) : Base(data, typename Helper::bounds_type{ size }) + typename Dummy = std::enable_if_t::value + && std::is_convertible::value>> + _CONSTEXPR array_view(T * const & data, size_type size) : Base(data, typename Helper::bounds_type{size}) { } // from n-dimensions static array template , typename Dummy = std::enable_if_t::value - && std::is_convertible::value >> - _CONSTEXPR array_view(T(&arr)[N]) : Base(arr, typename Helper::bounds_type()) + && std::is_convertible::value>> + _CONSTEXPR array_view (T (&arr)[N]) : Base(arr, typename Helper::bounds_type()) { } @@ -1725,11 +1725,11 @@ public: // from containers. It must has .size() and .data() two function signatures template ::value - && std::is_convertible::value + && std::is_convertible::value && std::is_convertible, typename Base::bounds_type>::value && std::is_same().size(), *std::declval().data())>, DataType>::value> > - _CONSTEXPR array_view(Cont& cont) : Base(static_cast(cont.data()), details::newBoundsHelper(cont.size())) + _CONSTEXPR array_view (Cont& cont) : Base(static_cast(cont.data()), details::newBoundsHelper(cont.size())) { } @@ -1752,7 +1752,7 @@ public: using BoundsType = typename array_view::bounds_type; auto tobounds = details::static_as_array_view_helper(dims..., details::Sep{}); details::verifyBoundsReshape(this->bounds(), tobounds); - return{ this->data(), tobounds }; + return {this->data(), tobounds}; } // to bytes array @@ -1761,7 +1761,7 @@ public: array_view, static_cast(details::StaticSizeHelper::value)> { static_assert(Enabled, "The value_type of array_view must be standarded layout"); - return{ reinterpret_cast(this->data()), this->bytes() }; + return { reinterpret_cast(this->data()), this->bytes() }; } template ::value_type>>::value> @@ -1769,9 +1769,10 @@ public: array_view, static_cast(details::StaticSizeHelper::value)> { static_assert(Enabled, "The value_type of array_view must be standarded layout"); - return{ reinterpret_cast(this->data()), this->bytes() }; + return { reinterpret_cast(this->data()), this->bytes() }; } + // from bytes array template::value, typename Dummy = std::enable_if_t> _CONSTEXPR auto as_array_view() const _NOEXCEPT -> array_view(dynamic_range))> @@ -1779,7 +1780,7 @@ public: static_assert(std::is_standard_layout::value && (Base::bounds_type::static_size == dynamic_range || Base::bounds_type::static_size % sizeof(U) == 0), "Target type must be standard layout and its size must match the byte array size"); fail_fast_assert((this->bytes() % sizeof(U)) == 0); - return{ reinterpret_cast(this->data()), this->bytes() / sizeof(U) }; + return { reinterpret_cast(this->data()), this->bytes() / sizeof(U) }; } template::value, typename Dummy = std::enable_if_t> @@ -1788,7 +1789,7 @@ public: static_assert(std::is_standard_layout::value && (Base::bounds_type::static_size == dynamic_range || Base::bounds_type::static_size % sizeof(U) == 0), "Target type must be standard layout and its size must match the byte array size"); fail_fast_assert((this->bytes() % sizeof(U)) == 0); - return{ reinterpret_cast(this->data()), this->bytes() / sizeof(U) }; + return { reinterpret_cast(this->data()), this->bytes() / sizeof(U) }; } // section on linear space @@ -1797,13 +1798,13 @@ public: { static_assert(bounds_type::static_size == dynamic_range || Count <= bounds_type::static_size, "Index is out of bound"); fail_fast_assert(bounds_type::static_size != dynamic_range || Count <= this->size()); // ensures we only check condition when needed - return{ this->data(), Count }; + return { this->data(), Count }; } _CONSTEXPR array_view first(size_type count) const _NOEXCEPT { fail_fast_assert(count <= this->size()); - return{ this->data(), count }; + return { this->data(), count }; } template @@ -1811,13 +1812,13 @@ public: { static_assert(bounds_type::static_size == dynamic_range || Count <= bounds_type::static_size, "Index is out of bound"); fail_fast_assert(bounds_type::static_size != dynamic_range || Count <= this->size()); - return{ this->data() + this->size() - Count, Count }; + return { this->data() + this->size() - Count, Count }; } _CONSTEXPR array_view last(size_type count) const _NOEXCEPT { fail_fast_assert(count <= this->size()); - return{ this->data() + this->size() - count, count }; + return { this->data() + this->size() - count, count }; } template @@ -1825,13 +1826,13 @@ public: { static_assert(bounds_type::static_size == dynamic_range || ((Offset == 0 || Offset < bounds_type::static_size) && Offset + Count <= bounds_type::static_size), "Index is out of bound"); fail_fast_assert(bounds_type::static_size != dynamic_range || ((Offset == 0 || Offset < this->size()) && Offset + Count <= this->size())); - return{ this->data() + Offset, Count }; + return { this->data() + Offset, Count }; } _CONSTEXPR array_view sub(size_type offset, size_type count) const _NOEXCEPT { fail_fast_assert((offset == 0 || offset < this->size()) && offset + count <= this->size()); - return{ this->data() + offset, count }; + return { this->data() + offset, count }; } // size