Skip to content

Commit ff1cf8c

Browse files
committed
Merge branch 'develop' into flattened-refactored
2 parents 39704e4 + ca8444a commit ff1cf8c

6 files changed

Lines changed: 26 additions & 45 deletions

File tree

include/boost/multi/array_ref.hpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,9 +1311,9 @@ class const_subarray : public array_types<T, D, ElementPtr, Layout> {
13111311
using element_cref = typename std::iterator_traits<element_const_ptr>::reference;
13121312

13131313
private:
1314-
using index_gen [[deprecated("here to fulfill MultiArray concept")]] = char*;
1315-
using extent_gen [[deprecated("here to fulfill MultiArray concept")]] = void;
1316-
using extent_range [[deprecated("here to fulfill MultiArray concept")]] = void;
1314+
using index_gen [[deprecated("here to fulfill backward-compatible MultiArray concept")]] = char*;
1315+
using extent_gen [[deprecated("here to fulfill backward-compatible MultiArray concept")]] = void;
1316+
using extent_range [[deprecated("here to fulfill backward-compatible MultiArray concept")]] = void;
13171317

13181318
// private:
13191319
using elements_iterator = elements_iterator_t<element_ptr, layout_type>;
@@ -2254,17 +2254,17 @@ class subarray : public const_subarray<T, D, ElementPtr, Layout> {
22542254
}
22552255
template<class It> BOOST_MULTI_HD constexpr auto assign(It first) && -> It { return assign(first); } // cppcheck-suppress duplInheritedMember ; to overwrite
22562256

2257-
template<class TT = typename subarray::element>
2258-
constexpr auto fill(TT const& value) & -> decltype(auto) {
2259-
return adl_fill_n(this->begin(), this->size(), value), *this;
2260-
}
2261-
constexpr auto fill() & -> decltype(auto) { return fill(typename subarray::element{}); }
2257+
// template<class TT = typename subarray::element>
2258+
// constexpr auto fill(TT const& value) & -> decltype(auto) {
2259+
// return adl_fill_n(this->begin(), this->size(), value), *this;
2260+
// }
2261+
// constexpr auto fill() & -> decltype(auto) { return fill(typename subarray::element{}); }
22622262

2263-
template<class TT = typename subarray::element>
2264-
[[deprecated]] constexpr auto fill(TT const& value) && -> decltype(auto) { return std::move(this->fill(value)); }
2265-
[[deprecated]] constexpr auto fill() && -> decltype(auto) {
2266-
return std::move(*this).fill(typename subarray::element{});
2267-
}
2263+
// template<class TT = typename subarray::element>
2264+
// [[deprecated]] constexpr auto fill(TT const& value) && -> decltype(auto) { return std::move(this->fill(value)); }
2265+
// [[deprecated]] constexpr auto fill() && -> decltype(auto) {
2266+
// return std::move(*this).fill(typename subarray::element{});
2267+
// }
22682268

22692269
using const_subarray<T, D, ElementPtr, Layout>::strided;
22702270
// cppcheck-suppress-begin duplInheritedMember ; to overwrite

include/boost/multi/detail/layout.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,12 +1700,12 @@ struct layout_t
17001700
[[deprecated("use get<d>(m.extensions()")]] // TODO(correaa) redeprecate, this is commented to give a smaller CI output
17011701
constexpr auto
17021702
extension(dimensionality_type dim) const {
1703-
return std::apply([](auto... extensions) -> auto { return std::array<index_extension, static_cast<std::size_t>(D)>{extensions...}; }, extensions().base()).at(static_cast<std::size_t>(dim));
1703+
return std::apply([](auto... extensions) -> auto { return std::array<index_extension, static_cast<std::size_t>(D)>{{extensions...}}; }, extensions().base()).at(static_cast<std::size_t>(dim));
17041704
} // cppcheck-suppress syntaxError ; bug in cppcheck 2.14
17051705
// [[deprecated("use get<d>(m.strides()) ")]] // TODO(correaa) redeprecate, this is commented to give a smaller CI output
1706-
constexpr auto stride(dimensionality_type dim) const {
1707-
return std::apply([](auto... strides) -> auto { return std::array<stride_type, static_cast<std::size_t>(D)>{strides...}; }, strides()).at(static_cast<std::size_t>(dim));
1708-
}
1706+
// constexpr auto stride(dimensionality_type dim) const {
1707+
// return std::apply([](auto... strides) -> auto { return std::array<stride_type, static_cast<std::size_t>(D)>{{strides...}}; }, strides()).at(static_cast<std::size_t>(dim));
1708+
// }
17091709
// [[deprecated("use get<d>(m.sizes()) ")]] // TODO(correaa) redeprecate, this is commented to give a smaller CI output
17101710
// constexpr auto size (dimensionality_type dim) const {return std::apply([](auto... sizes ) {return std::array<size_type , static_cast<std::size_t>(D)>{sizes ...};}, sizes () ).at(static_cast<std::size_t>(dim));}
17111711

include/boost/multi/utility.hpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,6 @@ auto extents(Container const& cont) {
538538
}
539539
}
540540

541-
template<class T> struct has_shape : decltype(has_shape_aux(std::declval<T>())){}; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg,cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay) trick
542-
543541
template<class T, typename = decltype(std::declval<T const&>().elements())>
544542
auto has_elements_aux(T const&) -> std::true_type;
545543
inline auto has_elements_aux(...) -> std::false_type;
@@ -571,16 +569,6 @@ constexpr auto extensions_aux2(BoostMultiArray const& arr, std::index_sequence<I
571569
);
572570
}
573571

574-
template<class Element, class T, std::enable_if_t<has_extents<T>::value, int> = 0> // NOLINT(modernize-use-constraints) TODO(correaa) in C++20
575-
[[nodiscard]] auto extents_of(T const& array) {
576-
if constexpr(std::is_convertible_v<T const&, Element>) {
577-
return boost::multi::extents_t<0>{};
578-
}
579-
if constexpr(std::is_convertible_v<typename T::reference, Element>) {
580-
return boost::multi::extents_t<1>{array.extents()};
581-
}
582-
}
583-
584572
template<class Arr2D>
585573
auto transposed(Arr2D&& arr)
586574
-> decltype(std::forward<Arr2D>(arr).transposed()) {
@@ -613,18 +601,6 @@ auto extents(T const& array) {
613601
return extensions_aux<D>::call(array);
614602
}
615603

616-
template<class T1> struct extensions_t_aux;
617-
618-
template<class T1, class T2> auto extensions_me(T2 const& array) {
619-
return extensions_t_aux<T1>::call(array);
620-
}
621-
622-
template<class T1> struct extension_t_aux {
623-
static auto call(T1 const& /*unused*/) { return std::make_tuple(); }
624-
template<class T2>
625-
static auto call(T2 const& array) { return tuple_cat(std::make_tuple(array.extent()), extensions_me<T1>(*begin(array))); }
626-
};
627-
628604
template<class T, typename = decltype(std::declval<T const&>().layout())>
629605
auto has_layout_member_aux(T const&) -> std::true_type;
630606
inline auto has_layout_member_aux(...) -> std::false_type;

test/element_transformed.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
#include <boost/core/lightweight_test.hpp> // IWYU pragma: keep
1313

14-
// IWYU pragma: no_include <algorithm> // for copy // for GNU stdlib
15-
// IWYU pragma: no_include <type_traits> // for declval // for GNU stdlib
14+
#include <algorithm> // for std::fill
15+
// IWYU pragma: no_include <type_traits> // for declval // for GNU stdlib
1616
#include <complex> // IWYU pragma: keep // for complex, operator*, operator+
1717
#include <iterator> // IWYU pragma: keep // for weakly_incrementable
1818
#include <utility> // IWYU pragma: keep // for declval, forward
@@ -267,7 +267,8 @@ auto main() -> int { // NOLINT(readability-function-cognitive-complexity,bugpro
267267
// std::fill(indirect_v.begin(), indirect_v.end(), 88.0);
268268

269269
#ifndef _MSC_VER
270-
indirect_v.fill(880);
270+
std::fill(indirect_v.begin(), indirect_v.end(), 880); // NOLINT(modernize-use-ranges) for C++20
271+
// indirect_v.fill(880);
271272
BOOST_TEST( vec[3] == 880 );
272273

273274
auto const& const_indirect_v = indirect_v;

test/fill.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ auto main() -> int { // NOLINT(readability-function-cognitive-complexity,bugpro
117117
namespace multi = boost::multi;
118118

119119
multi::array<int, 1> d1D = {10, 20, 30, 40};
120-
d1D.fill(420);
120+
std::fill(d1D.begin(), d1D.end(), 420); // NOLINT(modernize-use-ranges) for C++20
121121

122122
multi::array<int, 2> d2D = {
123123
{1500, 160, 170, 180, 190},

test/subarray.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,10 @@ auto main() -> int { // NOLINT(readability-function-cognitive-complexity,bugpro
303303
BOOST_TEST( &arr.apply(std::array<int, 1>{{1}})[1] == &arr[1][1] );
304304
}
305305
}
306+
// {
307+
// multi::array<int, 1> A({6}, 99);
308+
// [[maybe_unused]] auto&& B = A.stride(2); // ok, should not compile
309+
// }
306310

307311
return boost::report_errors();
308312
}

0 commit comments

Comments
 (0)