/*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
template <class ForwardIterator>
fbvector(ForwardIterator first, ForwardIterator last,
const Allocator& a, std::forward_iterator_tag)
- : impl_(std::distance(first, last), a)
+ : impl_(size_type(std::distance(first, last)), a)
{ M_uninitialized_copy_e(first, last); }
template <class InputIterator>
template <class ForwardIterator>
void assign(ForwardIterator first, ForwardIterator last,
std::forward_iterator_tag) {
- const size_t newSize = std::distance(first, last);
+ const auto newSize = size_type(std::distance(first, last));
if (newSize > capacity()) {
impl_.reset(newSize);
M_uninitialized_copy_e(first, last);
return;
}
if (impl_.b_)
- M_deallocate(impl_.b_, impl_.z_ - impl_.b_);
+ M_deallocate(impl_.b_, size_type(impl_.z_ - impl_.b_));
impl_.z_ = newB + newCap;
impl_.e_ = newB + (impl_.e_ - impl_.b_);
impl_.b_ = newB;
void make_window(iterator position, size_type n) {
// The result is guaranteed to be non-negative, so use an unsigned type:
- size_type tail = std::distance(position, impl_.e_);
+ size_type tail = size_type(std::distance(position, impl_.e_));
if (tail <= n) {
relocate_move(position + n, position, impl_.e_);
assert(isValid(cpos)); \
} \
T* position = const_cast<T*>(cpos); \
- size_type idx = std::distance(impl_.b_, position); \
+ size_type idx = size_type(std::distance(impl_.b_, position)); \
T* b; \
size_type newCap; /* intentionally uninitialized */ \
\
template <class FIt>
iterator insert(const_iterator cpos, FIt first, FIt last,
std::forward_iterator_tag) {
- size_type n = std::distance(first, last);
+ size_type n = size_type(std::distance(first, last));
FOLLY_FBVECTOR_INSERT_PRE(cpos, n)
FOLLY_FBVECTOR_INSERT_START(cpos, n)
D_uninitialized_copy_a(start, first, last);