Fix parameter types in copy_move_algo.hpp: iterator_traits::difference_type -> allocator_traits::size_type #40
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.
Many of the functions inside copy_move_algo.hpp construct n objects using a specified Allocator, so the number of objects should be given as allocator_traits::size_type. The callers of these functions already use size_type, which currently leads to type conflicts if the InputIterator's difference_type is incompatible (e.g., smaller).
There is one exception in vector.hpp, where uninitialized_move_alloc_n() is called with a raw pointer difference. I static_casted this to size_type for compatibility.
There are several remaining functions inside copy_move_algo.hpp that use a difference_type parameter, but are independent of an allocator. I changed these to be agnostic of the integral type, as was already done with destroy_alloc_n(). (In fact, all of these functions eventually get called with allocator_traits::size_type arguments.)