Skip to content

Add contains() method to check if an index is within array bounds#1593

Open
theoxfaber wants to merge 1 commit into
rust-ndarray:masterfrom
theoxfaber:add-contains-method
Open

Add contains() method to check if an index is within array bounds#1593
theoxfaber wants to merge 1 commit into
rust-ndarray:masterfrom
theoxfaber:add-contains-method

Conversation

@theoxfaber
Copy link
Copy Markdown

Adds a contains() method to ArrayBase to check whether a given index falls within array dimensions without accessing the element.

Closes #1247

let a = arr2(&[[1., 2.], [3., 4.]]);
assert!(a.contains((0, 1)));
assert!(!a.contains((2, 0)));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Array bounds/contains check?

1 participant