From 4ecd92516dffecaa1a6101b8d2c4b44b3f13a89b Mon Sep 17 00:00:00 2001 From: Divye Gala Date: Tue, 26 Nov 2024 09:10:28 -0500 Subject: [PATCH] Switch `assert` to `static_assert` (#2510) This problem came up in cuVS CI here https://github.com/rapidsai/cuvs/actions/runs/11982382629/job/33410385067?pr=465#step:10:558 as an `unused-variable` error. --- cpp/include/raft/core/device_mdspan.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/include/raft/core/device_mdspan.hpp b/cpp/include/raft/core/device_mdspan.hpp index b4e9f8d1d7..c5241e831b 100644 --- a/cpp/include/raft/core/device_mdspan.hpp +++ b/cpp/include/raft/core/device_mdspan.hpp @@ -210,7 +210,7 @@ auto constexpr make_device_strided_matrix_view(ElementType* ptr, constexpr auto is_row_major = std::is_same_v; constexpr auto is_col_major = std::is_same_v; - assert(is_row_major || is_col_major); + static_assert(is_row_major || is_col_major, "Unsupported layout policy for strided matrix view"); IndexType stride0 = is_row_major ? (stride > 0 ? stride : n_cols) : 1; IndexType stride1 = is_row_major ? 1 : (stride > 0 ? stride : n_rows);