Remove spaces from sim3 type names #830
Merged
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.
Discovered while experimenting with g2o cli utility. Spaces introduced by clang-format in a70b6d7 prevent these types from being parsable from a file.
Several similar fixes were already applied to other types (e.g. e28160d and 25e393e), but types/sim were missed on those occasions.
My recommendation for a more robust fix would be to change the type registration macro thus:
... and provide character literals at the type registration site:
This would prevent clang-format from interfering with those values in the future. I have a commit with this fix already ready, and if you wish, can provide it in addition to or instead of this PR.
This would of course not be backward-compatible with other projects that might use g2o and register their own types. If backward-compatibility were desired, a new
G2O_REGISTER_TYPE_NAME
macro could be introduced that expects a character literal, andG2O_REGISTER_TYPE
macro could remain (deprecated) purely for backward-compatibility.Additionally or alternatively, run-time checking of type names could be added in
RegisterTypeProxy
constructor, and flag or replace characters that could impede parsing. In C++20 a template-based solution could probably be used to validate characters at compile time, but I digress.@RainerKuemmerle, I am offering to implement, at your discretion, either the straight-forward change, or the backward-compatible one. Just let me know in this PR which one you prefer, if any, and I can enter an issue with the chosen proposal and develop the fix.