Skip to content

Read-only matrix indexing operators and iterator methods are not const #234

Closed
@anthonynorth

Description

@anthonynorth

The index operator, call operator, begin and end methods should be const for a read-only matrix.

All statements in the below snippet are compile errors.

void matrix_const(const cpp11::integers_matrix& mat) {
  mat[0]; 
  mat[0][0];
  mat(0, 0);
  mat.begin();
  mat.end();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions