mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-10 10:52:31 -05:00
refactor: Require std::input_iterator for all InputIterator in prevector
This commit is contained in:
parent
d444441900
commit
fa7b9b99a2
1 changed files with 9 additions and 9 deletions
|
@ -5,13 +5,13 @@
|
||||||
#ifndef BITCOIN_PREVECTOR_H
|
#ifndef BITCOIN_PREVECTOR_H
|
||||||
#define BITCOIN_PREVECTOR_H
|
#define BITCOIN_PREVECTOR_H
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cassert>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
#include <iterator>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ private:
|
||||||
std::fill_n(dst, count, value);
|
std::fill_n(dst, count, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename InputIterator>
|
template <std::input_iterator InputIterator>
|
||||||
void fill(T* dst, InputIterator first, InputIterator last) {
|
void fill(T* dst, InputIterator first, InputIterator last) {
|
||||||
while (first != last) {
|
while (first != last) {
|
||||||
new(static_cast<void*>(dst)) T(*first);
|
new(static_cast<void*>(dst)) T(*first);
|
||||||
|
@ -229,7 +229,7 @@ public:
|
||||||
fill(item_ptr(0), n, val);
|
fill(item_ptr(0), n, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename InputIterator>
|
template <std::input_iterator InputIterator>
|
||||||
void assign(InputIterator first, InputIterator last) {
|
void assign(InputIterator first, InputIterator last) {
|
||||||
size_type n = last - first;
|
size_type n = last - first;
|
||||||
clear();
|
clear();
|
||||||
|
@ -252,7 +252,7 @@ public:
|
||||||
fill(item_ptr(0), n, val);
|
fill(item_ptr(0), n, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename InputIterator>
|
template <std::input_iterator InputIterator>
|
||||||
prevector(InputIterator first, InputIterator last) {
|
prevector(InputIterator first, InputIterator last) {
|
||||||
size_type n = last - first;
|
size_type n = last - first;
|
||||||
change_capacity(n);
|
change_capacity(n);
|
||||||
|
@ -381,7 +381,7 @@ public:
|
||||||
fill(item_ptr(p), count, value);
|
fill(item_ptr(p), count, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename InputIterator>
|
template <std::input_iterator InputIterator>
|
||||||
void insert(iterator pos, InputIterator first, InputIterator last) {
|
void insert(iterator pos, InputIterator first, InputIterator last) {
|
||||||
size_type p = pos - begin();
|
size_type p = pos - begin();
|
||||||
difference_type count = last - first;
|
difference_type count = last - first;
|
||||||
|
|
Loading…
Add table
Reference in a new issue