Formatting

This commit is contained in:
Anna Gringauze 2015-09-14 18:55:06 -07:00
parent 4328354581
commit 1a86498733
2 changed files with 16 additions and 16 deletions

View File

@ -295,8 +295,8 @@ public:
} }
_CONSTEXPR static index shift_left(const index<rank+1, value_type>& other) _NOEXCEPT _CONSTEXPR static index shift_left(const index<rank+1, value_type>& other) _NOEXCEPT
{ {
value_type (&arr)[rank] = (value_type(&)[rank])(*(other.elems + 1)); value_type (&arr)[rank] = (value_type(&)[rank])(*(other.elems + 1));
return index(arr); return index(arr);
} }
using Base::operator[]; using Base::operator[];
@ -1860,12 +1860,12 @@ public:
return{ &this->operator[](origin), size, strided_bounds<rank, size_type> {extents, details::make_stride(Base::bounds())} }; return{ &this->operator[](origin), size, strided_bounds<rank, size_type> {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); return Base::operator[](idx);
} }
template <bool Enabled = (rank > 1), typename Dummy = std::enable_if_t<Enabled>> template <bool Enabled = (rank > 1), typename Dummy = std::enable_if_t<Enabled>>
_CONSTEXPR array_view<ValueTypeOpt, RestDimensions...> operator[](size_type idx) const _CONSTEXPR array_view<ValueTypeOpt, RestDimensions...> operator[](size_type idx) const
{ {
auto ret = Base::operator[](idx); auto ret = Base::operator[](idx);
@ -1946,7 +1946,7 @@ public:
using typename Base::index_type; using typename Base::index_type;
using typename Base::iterator; using typename Base::iterator;
using typename Base::const_iterator; using typename Base::const_iterator;
using typename Base::reference; using typename Base::reference;
// from static array of size N // from static array of size N
template<size_type N> template<size_type N>
@ -1979,8 +1979,8 @@ public:
} }
// convert from bytes // convert from bytes
template <typename OtherValueType> template <typename OtherValueType>
strided_array_view<typename std::enable_if<std::is_same<value_type, const byte>::value, OtherValueType>::type, rank> as_strided_array_view() const strided_array_view<typename std::enable_if<std::is_same<value_type, const byte>::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"); 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); auto d = sizeof(OtherValueType) / sizeof(value_type);
@ -1996,9 +1996,9 @@ public:
} }
_CONSTEXPR reference operator[](const index_type& idx) const _CONSTEXPR reference operator[](const index_type& idx) const
{ {
return Base::operator[](idx); return Base::operator[](idx);
} }
template <bool Enabled = (rank > 1), typename Dummy = std::enable_if_t<Enabled>> template <bool Enabled = (rank > 1), typename Dummy = std::enable_if_t<Enabled>>
_CONSTEXPR strided_array_view<value_type, rank-1> operator[](size_type idx) const _CONSTEXPR strided_array_view<value_type, rank-1> operator[](size_type idx) const

View File

@ -362,7 +362,7 @@ SUITE(array_view_tests)
#else #else
strided_array_view<const volatile int, 1> sav_cv{ array_view<const volatile int>{src}, strided_bounds<1>{2, 1} }; strided_array_view<const volatile int, 1> sav_cv{ array_view<const volatile int>{src}, strided_bounds<1>{2, 1} };
#endif #endif
CHECK(sav_cv.bounds().index_bounds() == index<1>{ 2 }); CHECK(sav_cv.bounds().index_bounds() == index<1>{ 2 });
CHECK(sav_cv.bounds().strides() == index<1>{ 1 }); CHECK(sav_cv.bounds().strides() == index<1>{ 1 });
CHECK(sav_cv[1] == 2); CHECK(sav_cv[1] == 2);
@ -899,7 +899,7 @@ SUITE(array_view_tests)
for (unsigned int i = 0; i < section.size(); ++i) 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]); 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) 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]); 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 j = 0; j < section.extent<1>(); ++j)
for (unsigned int k = 0; k < section.extent<2>(); ++k) 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]); CHECK(section[idx] == expected[2 * i + 2 * j + k]);
} }
} }
for (unsigned int i = 0; i < section.extent<0>(); ++i) for (unsigned int i = 0; i < section.extent<0>(); ++i)