Skip to content

Commit

Permalink
Use CONSTEXPR_DCHECK in constexpr functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
pleroy committed Jan 3, 2024
1 parent ccf825d commit 29d9330
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions numerics/matrix_computations_body.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ ColumnView<Scalar, Matrix>::operator UnboundedVector<Scalar>() const {

template<typename Scalar, typename Matrix>
constexpr Scalar& ColumnView<Scalar, Matrix>::operator[](int const index) {
DCHECK_LE(index, last_row - first_row);
CONSTEXPR_DCHECK(index <= last_row - first_row);
return matrix(first_row + index, column);
}

template<typename Scalar, typename Matrix>
constexpr Scalar const& ColumnView<Scalar, Matrix>::operator[](
int const index) const {
DCHECK_LE(index, last_row - first_row);
CONSTEXPR_DCHECK(index <= last_row - first_row);
return matrix(first_row + index, column);
}

Expand Down Expand Up @@ -149,17 +149,17 @@ constexpr int BlockView<Scalar, Matrix>::columns() const {
template<typename Scalar, typename Matrix>
constexpr Scalar& BlockView<Scalar, Matrix>::operator()(int const row,
int const column) {
DCHECK_LE(row, last_row - first_row);
DCHECK_LE(column, last_column - first_column);
CONSTEXPR_DCHECK(row <= last_row - first_row);
CONSTEXPR_DCHECK(column <= last_column - first_column);
return matrix(first_row + row, first_column + column);
}

template<typename Scalar, typename Matrix>
constexpr Scalar const& BlockView<Scalar, Matrix>::operator()(
int const row,
int const column) const {
DCHECK_LE(row, last_row - first_row);
DCHECK_LE(column, last_column - first_column);
CONSTEXPR_DCHECK(row <= last_row - first_row);
CONSTEXPR_DCHECK(column <= last_column - first_column);
return matrix(first_row + row, first_column + column);
}

Expand Down

0 comments on commit 29d9330

Please sign in to comment.