Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initializes unused metadata in constexpr-rank arrays #181

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions btas/array_adaptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ namespace btas {
static array construct(std::size_t n) {
assert(n <= N);
array result;
// fill elements n+1 ... N-1 with zeroes
std::fill_n(result.begin() + n, N - n, value_type{});
return result;
}
static array construct(std::size_t n, T value) {
Expand Down
4 changes: 4 additions & 0 deletions unittest/range_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ TEST_CASE("Range")
typedef RangeNd<blas::Layout::RowMajor, std::array<size_t, 3>> Range3d;
Range3d x;
CHECK(x.rank()== 3);
CHECK(x.area()== 0);
Range3d x1(std::array<int,0>{},std::array<int,0>{});
CHECK(x1.rank()== 3);
CHECK(x1.area()== 0);
}
SECTION("Col-major std::vector-based Range")
{
Expand Down
Loading