More informative exception if invalid access of image/camera/point3D#2825
Merged
More informative exception if invalid access of image/camera/point3D#2825
Conversation
B1ueber2y
approved these changes
Oct 6, 2024
ahojnnes
reviewed
Oct 7, 2024
src/colmap/scene/reconstruction.h
Outdated
|
|
||
| struct Camera& Reconstruction::Camera(const camera_t camera_id) { | ||
| return cameras_.at(camera_id); | ||
| return const_cast<struct Camera&>( |
Contributor
There was a problem hiding this comment.
I'd suggest replicating the code here instead of the const cast. I am not sure if the compiler makes some optimizations with the const that then get violated by this const cast. Code replication is not all that bad and here the savings are also marginal.
ahojnnes
reviewed
Oct 7, 2024
ahojnnes
approved these changes
Oct 7, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
reconstruction.Image(image_id)for a nonexistent image ID raises an exception with the uninformative message_Map_base::at. This is especially confusing for Python users. This PR makes the exception message more informative.