[PATCH] [libc++] Move enable_if to 2nd argument of std::vector(iterator, iterator) ctor

Howard Hinnant howard.hinnant at gmail.com
Sat Sep 21 15:33:27 PDT 2013


On Sep 21, 2013, at 6:12 PM, Richard Smith <richard at metafoo.co.uk> wrote:

> 
> 
> ================
> Comment at: include/vector:521-528
> @@ -520,9 +520,10 @@
>     vector(size_type __n, const_reference __x, const allocator_type& __a);
>     template <class _InputIterator>
> -        vector(_InputIterator __first, _InputIterator __last,
> +        vector(_InputIterator __first,
>                typename enable_if<__is_input_iterator  <_InputIterator>::value &&
>                                  !__is_forward_iterator<_InputIterator>::value &&
>                                  is_constructible<
>                                     value_type,
> -                                    typename iterator_traits<_InputIterator>::reference>::value>::type* = 0);
> +                                    typename iterator_traits<_InputIterator>::reference>::value,
> +                                 _InputIterator>::type __last);
>     template <class _InputIterator>
> ----------------
> I don't believe this is a correct change.
> 
>    std::vector<int> v( {}, my_weird_iterator );
> 
> ... cannot deduce the type of `_InputIterator`.

But is:

std::vector<int> v( {}, my_weird_iterator );

valid without the change?

Howard





More information about the cfe-commits mailing list