Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parameter types in copy_move_algo.hpp: iterator_traits::difference_type -> allocator_traits::size_type #40

Merged
merged 2 commits into from Nov 12, 2016

Conversation

Projects
None yet
2 participants
@togermer
Copy link

commented Oct 19, 2016

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.)

@igaztanaga igaztanaga merged commit 3830745 into boostorg:develop Nov 12, 2016

@igaztanaga

This comment has been minimized.

Copy link
Member

commented Nov 12, 2016

Thanks for the pull!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.