Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generic Rhs parameter for traits and structs and generalize implementations for [T] #48

Merged
merged 3 commits into from Jan 13, 2019

Conversation

jturner314
Copy link
Contributor

Adding a Rhs parameter makes them match std::cmp::PartialEq. It's also necessary to make it possible to implement the *Eq traits for some combinations of types, such as ndarray::ArrayBase<S, D> instances of differing storage S (e.g. owned and view). (See the implementation of PartialEq for ArrayBase for an example.)

This PR also implements *Eq<[B]> for [A], analogous to this PartialEq implementation.

As far as I can tell, this is a backwards compatible change since it retains Self as the default for Rhs.

This makes them match `std::cmp::PartialEq`. It's also necessary to
make it possible to implement the `*Eq` traits for some combinations
of types, such as `ndarray::ArrayBase<S, D>` instances of differing
storage `S` (e.g. owned and view).
This is necessary for the macros to function correctly when the left
and right hand sides have different types.
@jturner314
Copy link
Contributor Author

I just realized that I needed to update the structs too (AbsDiff, Relative, Ulps). I pushed a commit that does so.

@jturner314 jturner314 changed the title Add generic Rhs parameter for *Eq traits and generalize implementations for [T] Add generic Rhs parameter for traits and structs and generalize implementations for [T] Jan 11, 2019
@brendanzab
Copy link
Owner

Ohh, this is a very nice change! Thanks!

@brendanzab brendanzab merged commit 492e9b5 into brendanzab:master Jan 13, 2019
@jturner314 jturner314 deleted the generic-rhs branch February 25, 2019 04:48
@azriel91 azriel91 mentioned this pull request Mar 14, 2019
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.

None yet

2 participants