Canonicalize PointStamp
representation
#458
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.
PointStamp
represents an infinite vector ofT
elements, extending a maintainedvector
withT::minimum()
. This allows multiple representations of the same vector when thevector
is allowed to end withT::minimum()
, which was documented as acceptable. However, it does mean that e.g. the derivedEq
implementation, among others, would report two logically identical pointstamps as different, and imo the position that there can be multiple unequal representations of the same state is untenable.This PR removes that ability, short of direct manipulation by users, through an
enforce
method that is called by a constructor, and use of that constructor whenever we mint newPointStamp
s. Demonstration uses that manipulatevector
directly are followed byenforce
calls.We could go further and make the field private, and prevent direct manipulation and require clones (or at least
into_vec
andfrom_vec
patterns). That might increase confidence even further.cc: @antiguru