diff --git a/include/array_view.h b/include/array_view.h index 2ff693e..ec3edfd 100644 --- a/include/array_view.h +++ b/include/array_view.h @@ -295,8 +295,8 @@ public: } _CONSTEXPR static index shift_left(const index& other) _NOEXCEPT { - value_type (&arr)[rank] = (value_type(&)[rank])(*(other.elems + 1)); - return index(arr); + value_type (&arr)[rank] = (value_type(&)[rank])(*(other.elems + 1)); + return index(arr); } using Base::operator[]; @@ -1860,12 +1860,12 @@ public: return{ &this->operator[](origin), size, strided_bounds {extents, details::make_stride(Base::bounds())} }; } - _CONSTEXPR reference operator[](const index_type& idx) const + _CONSTEXPR reference operator[](const index_type& idx) const { return Base::operator[](idx); } - template 1), typename Dummy = std::enable_if_t> + template 1), typename Dummy = std::enable_if_t> _CONSTEXPR array_view operator[](size_type idx) const { auto ret = Base::operator[](idx); @@ -1946,7 +1946,7 @@ public: using typename Base::index_type; using typename Base::iterator; using typename Base::const_iterator; - using typename Base::reference; + using typename Base::reference; // from static array of size N template @@ -1979,8 +1979,8 @@ public: } // convert from bytes - template - strided_array_view::value, OtherValueType>::type, rank> as_strided_array_view() const + template + strided_array_view::value, OtherValueType>::type, 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); @@ -1996,9 +1996,9 @@ public: } _CONSTEXPR reference operator[](const index_type& idx) const - { - return Base::operator[](idx); - } + { + return Base::operator[](idx); + } template 1), typename Dummy = std::enable_if_t> _CONSTEXPR strided_array_view operator[](size_type idx) const diff --git a/tests/array_view_tests.cpp b/tests/array_view_tests.cpp index 0525f9d..5c64119 100644 --- a/tests/array_view_tests.cpp +++ b/tests/array_view_tests.cpp @@ -362,7 +362,7 @@ SUITE(array_view_tests) #else strided_array_view sav_cv{ array_view{src}, strided_bounds<1>{2, 1} }; #endif - + CHECK(sav_cv.bounds().index_bounds() == index<1>{ 2 }); CHECK(sav_cv.bounds().strides() == index<1>{ 1 }); CHECK(sav_cv[1] == 2); @@ -899,7 +899,7 @@ SUITE(array_view_tests) for (unsigned int i = 0; i < section.size(); ++i) { - auto idx = index<2>{ i,0 }; // avoid braces inside the CHECK macro + auto idx = index<2>{ i,0 }; // avoid braces inside the CHECK macro CHECK(section[idx] == av[i][1]); } @@ -909,7 +909,7 @@ SUITE(array_view_tests) { for (unsigned int j = 0; j < section.bounds().index_bounds()[1]; ++j) { - auto idx = index<2>{ i,j }; // avoid braces inside the CHECK macro + auto idx = index<2>{ i,j }; // avoid braces inside the CHECK macro CHECK(section[idx] == av[i][1]); } } @@ -1048,10 +1048,10 @@ SUITE(array_view_tests) { for (unsigned int j = 0; j < section.extent<1>(); ++j) for (unsigned int k = 0; k < section.extent<2>(); ++k) - { - auto idx = index<3>{ i,j,k }; // avoid braces in the CHECK macro + { + auto idx = index<3>{ i,j,k }; // avoid braces in the CHECK macro CHECK(section[idx] == expected[2 * i + 2 * j + k]); - } + } } for (unsigned int i = 0; i < section.extent<0>(); ++i)