Implement prevector::fill once

Now that the implementation is identical, we can use a default value to
distinguish them.
This commit is contained in:
Ben Woosley 2018-11-13 04:15:27 -05:00
parent 7bad78c2c8
commit 69ca48717c
No known key found for this signature in database
GPG key ID: 6EE5F3785F78B345

View file

@ -196,11 +196,7 @@ private:
T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
void fill(T* dst, ptrdiff_t count) { void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
std::fill_n(dst, count, T{});
}
void fill(T* dst, ptrdiff_t count, const T& value) {
std::fill_n(dst, count, value); std::fill_n(dst, count, value);
} }