Give collection_size_type explicit increment, decrement, and stream extractor - #358
Closed
gennaroprota wants to merge 1 commit into
Closed
Conversation
…xtractor `collection_size_type` had no increment, decrement, or stream extractor but had an implicit conversion to a modifiable reference to its stored size (`operator base_type &`) which allowed the built-in operators to apply. Remove that mutable-reference conversion and provide the operations the library actually needs explicitly: pre/post `++` and `--`, and an `operator>>` for input (templated on the character type, so it serves narrow and wide text and XML archives). The read-only `operator base_type() const` is kept: output, container sizing, and comparisons go through it, so no call sites change. The on-disk format is unchanged. Binary archives already serialize the type bitwise; text and XML still read and write the same size through `is >> x` / `os << x`. Adds test_collection_size_type, which checks the operators directly and round-trips a value through every archive type. Closes #192.
Collaborator
Author
|
Closing this without merging. See #192 (comment). |
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.
collection_size_typehad no increment, decrement, or stream extractor but had an implicit conversion to a modifiable reference to its stored size (operator base_type &) which allowed the built-in operators to apply.Remove that mutable-reference conversion and provide the operations the library actually needs explicitly: pre/post
++and--, and anoperator>>for input (templated on the character type, so it serves narrow and wide text and XML archives). The read-onlyoperator base_type() constis kept: output, container sizing, and comparisons go through it, so no call sites change.The on-disk format is unchanged. Binary archives already serialize the type bitwise; text and XML still read and write the same size through
is >> x/os << x.Adds test_collection_size_type, which checks the operators directly and round-trips a value through every archive type.
Closes #192.