<div dir="ltr"><div><div><div><div><div><div>The code for vector insert method<br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span style="font-family:courier new,monospace">template <class _Tp, class _Allocator></span><br>
<span style="font-family:courier new,monospace">template <class _ForwardIterator></span><br><span style="font-family:courier new,monospace">typename enable_if</span><br><span style="font-family:courier new,monospace"><</span><br>
<span style="font-family:courier new,monospace"> __is_forward_iterator<_ForwardIterator>::value &&</span><br><span style="font-family:courier new,monospace"> is_constructible<</span><br><span style="font-family:courier new,monospace"> _Tp,</span><br>
<span style="font-family:courier new,monospace"> typename iterator_traits<_ForwardIterator>::reference>::value,</span><br><span style="font-family:courier new,monospace"> typename vector<_Tp, _Allocator>::iterator</span><br>
<span style="font-family:courier new,monospace">>::type</span><br><span style="font-family:courier new,monospace">vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last)</span><br>
<span style="font-family:courier new,monospace"></span></blockquote><br></div>(starting at line 1870 in file include/vector) requires that _ForwardIterator be copy assignable at line 1900.<br><br>Normally forward iterators will be copy assignable, but there are cases when the iterator is not. One such case is when using boost::filter_iterator with a Predicate type that is not copy assignable.<br>
<br></div>Does _ForwardIterator have to be copy assignable? or<br>Is the use of the enable_if template incomplete for this case? or<br>Is this a fault in boost::filter_iterator with its traits specification?<br></div></div>
Or is the code wrong? (there's a simple fix to it, but it may be too simple!) or<br></div><div>Something else?<br></div><div><br></div>Attached is a short program that exhibits the problem. It compiles and runs with gcc 4.8.1 and clang 3.4 when using gcc's includes. It fails to compile when using libc++ includes.<br>
<br></div>Cheers<br>Dan<br></div>