diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h --- a/llvm/include/llvm/ADT/SmallVector.h +++ b/llvm/include/llvm/ADT/SmallVector.h @@ -34,6 +34,11 @@ template class iterator_range; +template +using EnableIfConvertibleToInputIterator = std::enable_if_t::iterator_category, + std::input_iterator_tag>::value>; + /// This is all the stuff common to all SmallVectors. /// /// The template parameter specifies the type which should be used to hold the @@ -660,11 +665,8 @@ void swap(SmallVectorImpl &RHS); /// Add the specified range to the end of the SmallVector. - template ::iterator_category, - std::input_iterator_tag>::value>> - void append(in_iter in_start, in_iter in_end) { + template > + void append(ItTy in_start, ItTy in_end) { this->assertSafeToAddRange(in_start, in_end); size_type NumInputs = std::distance(in_start, in_end); this->reserve(this->size() + NumInputs); @@ -704,11 +706,8 @@ // FIXME: Consider assigning over existing elements, rather than clearing & // re-initializing them - for all assign(...) variants. - template ::iterator_category, - std::input_iterator_tag>::value>> - void assign(in_iter in_start, in_iter in_end) { + template > + void assign(ItTy in_start, ItTy in_end) { this->assertSafeToReferenceAfterClear(in_start, in_end); clear(); append(in_start, in_end); @@ -858,10 +857,7 @@ return I; } - template ::iterator_category, - std::input_iterator_tag>::value>> + template > iterator insert(iterator I, ItTy From, ItTy To) { // Convert iterator to elt# to avoid invalidating iterator when we reserve() size_t InsertElt = I - this->begin(); @@ -1197,10 +1193,7 @@ this->assign(Size, Value); } - template ::iterator_category, - std::input_iterator_tag>::value>> + template > SmallVector(ItTy S, ItTy E) : SmallVectorImpl(N) { this->append(S, E); }