How to implement with generic_const_expr?
⚓ Rust 📅 2025-12-13 👤 surdeus 👁️ 1Cannot use generic const parameters in arithmetic operations
impl<T, const R: usize, const C: usize> Matrix<T, R, C>
where
T: Default + Copy,
{
pub fn minor_matrix(&self, row: usize, col: usize) -> Matrix<T, { C - 1 }, { R - 1 }> {
let mut result = Matrix::default();
let mut new_r = 0;
for r in 0..R {
if r == row {
continue;
}
let mut new_c = 0;
for c in 0..C {
if c == col {
continue;
}
result[new_r][new_c] = self[r][c];
new_c += 1;
}
new_r += 1;
}
result
}
}
1 post - 1 participant
🏷️ Rust_feed