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

DM-9192 add == and toString for new BoundedField API #77

Merged
merged 1 commit into from Apr 28, 2017

Conversation

parejkoj
Copy link
Contributor

These were added to the Boundedfield API as part of the work on PhotoCalib.

@parejkoj parejkoj force-pushed the tickets/DM-9192 branch 5 times, most recently from 00b6a7e to f1a1951 Compare April 28, 2017 09:40
}
catch (std::bad_cast&) {
return false;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend converting the try block to:

auto rhsCasted = dynamic_cast<CoaddBoundedfield const *>(&rhs);
if (!rhsCasted) {
    return false;
}
...

Some (most?) compilers make checking for nullptr much faster than throwing and catching an exception, so when you don't actually gain anything from exceptions (e.g. unwinding the stack gracefully) it's better to use the pointer form of dynamic_cast.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion. I've implemented this here, and done the same for ChebyshevBoundedField.

@parejkoj parejkoj merged commit 148a2b5 into master Apr 28, 2017
@ktlim ktlim deleted the tickets/DM-9192 branch August 25, 2018 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants