mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Fix template pack expansion bug in multi_span.
* Fix issue #333 by moving a parenthesis. * Added test to prove fix is good.
This commit is contained in:
parent
bdcef948a5
commit
9523c1842e
@ -1488,7 +1488,7 @@ public:
|
||||
constexpr reference operator()(FirstIndex index, OtherIndices... indices)
|
||||
{
|
||||
index_type idx = {narrow_cast<std::ptrdiff_t>(index),
|
||||
narrow_cast<std::ptrdiff_t>(indices...)};
|
||||
narrow_cast<std::ptrdiff_t>(indices)...};
|
||||
return this->operator[](idx);
|
||||
}
|
||||
|
||||
|
@ -941,8 +941,17 @@ SUITE(multi_span_tests)
|
||||
{
|
||||
multi_span<int, 2, 3> s = arr2d;
|
||||
CHECK(s(0, 0) == 1);
|
||||
CHECK(s(0, 1) == 2);
|
||||
CHECK(s(1, 2) == 6);
|
||||
}
|
||||
|
||||
int arr3d[2][2][2] = {1, 2, 3, 4, 5, 6, 7, 8};
|
||||
|
||||
{
|
||||
multi_span<int, 2, 2, 2> s = arr3d;
|
||||
CHECK(s(0, 0, 0) == 1);
|
||||
CHECK(s(1, 1, 1) == 8);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(comparison_operators)
|
||||
|
Loading…
Reference in New Issue
Block a user