From 18cd9801b515151e09e1c3eb203ef294f0ff8421 Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Mon, 14 Sep 2015 16:34:26 -0700 Subject: [PATCH 1/2] Reverted formatting changes --- include/array_view.h | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/include/array_view.h b/include/array_view.h index 6af4d8d..ff3b1cf 100644 --- a/include/array_view.h +++ b/include/array_view.h @@ -1637,7 +1637,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; @@ -1672,17 +1672,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()) { } @@ -1718,11 +1718,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())) { } @@ -1745,7 +1745,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 @@ -1754,7 +1754,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> @@ -1762,9 +1762,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))> @@ -1772,7 +1773,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> @@ -1781,7 +1782,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 @@ -1790,13 +1791,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 @@ -1804,13 +1805,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 @@ -1818,13 +1819,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 @@ -1849,7 +1850,7 @@ public: _CONSTEXPR strided_array_view section(index_type origin, index_type extents) const { size_type size = bounds().total_size() - bounds().linearize(origin); - return{ &this->operator[](origin), size, strided_bounds {extents, details::make_stride(Base::bounds())} }; + return { &this->operator[](origin), size, strided_bounds {extents, details::make_stride(Base::bounds())} }; } _CONSTEXPR reference operator[](const index_type& idx) const { From e5b79d242c222e7f4c1b34456b22f3f45c08d0fb Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Mon, 14 Sep 2015 16:38:25 -0700 Subject: [PATCH 2/2] Reverted formatting changes --- include/array_view.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/array_view.h b/include/array_view.h index ff3b1cf..419397d 100644 --- a/include/array_view.h +++ b/include/array_view.h @@ -1682,7 +1682,7 @@ public: template , typename Dummy = std::enable_if_t::value && std::is_convertible::value>> - _CONSTEXPR array_view(T (&arr)[N]) : Base(arr, typename Helper::bounds_type()) + _CONSTEXPR array_view (T (&arr)[N]) : Base(arr, typename Helper::bounds_type()) { }