diff options
author | Howard Hinnant <hhinnant@apple.com> | 2013-09-21 21:13:54 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2013-09-21 21:13:54 +0000 |
commit | 7a828034c6cb65b846b8f7b18d730dd109f65b9e (patch) | |
tree | c9988b01ec58f3fb553d01a59d4a48fafcdabe46 /libcxx/include/vector | |
parent | 1da6b4d5c8167fde7a74c0cf9245de088a1f059d (diff) | |
download | bcm5719-llvm-7a828034c6cb65b846b8f7b18d730dd109f65b9e.tar.gz bcm5719-llvm-7a828034c6cb65b846b8f7b18d730dd109f65b9e.zip |
Peter Collingbourne: If a pointer is passed as the third argument of the (iterator,
iterator, allocator) constructor with the intention of it being
implicitly converted to the allocator type, it is possible for overload
resolution to favour the (iterator, iterator, enable_if) constructor.
Eliminate this possibility by moving the enable_if to one of the
existing arguments and removing the third argument.
llvm-svn: 191145
Diffstat (limited to 'libcxx/include/vector')
-rw-r--r-- | libcxx/include/vector | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/libcxx/include/vector b/libcxx/include/vector index 258a950dc7d..619faaa5f63 100644 --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -524,12 +524,13 @@ public: vector(size_type __n, const_reference __x); 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> vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a, typename enable_if<__is_input_iterator <_InputIterator>::value && @@ -538,11 +539,12 @@ public: value_type, typename iterator_traits<_InputIterator>::reference>::value>::type* = 0); template <class _ForwardIterator> - vector(_ForwardIterator __first, _ForwardIterator __last, + vector(_ForwardIterator __first, typename enable_if<__is_forward_iterator<_ForwardIterator>::value && is_constructible< value_type, - typename iterator_traits<_ForwardIterator>::reference>::value>::type* = 0); + typename iterator_traits<_ForwardIterator>::reference>::value, + _ForwardIterator>::type __last); template <class _ForwardIterator> vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, typename enable_if<__is_forward_iterator<_ForwardIterator>::value && @@ -1072,12 +1074,13 @@ vector<_Tp, _Allocator>::vector(size_type __n, const_reference __x, const alloca template <class _Tp, class _Allocator> template <class _InputIterator> -vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, +vector<_Tp, _Allocator>::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*) + typename iterator_traits<_InputIterator>::reference>::value, + _InputIterator>::type __last) { #if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this); @@ -1105,11 +1108,12 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, c template <class _Tp, class _Allocator> template <class _ForwardIterator> -vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, +vector<_Tp, _Allocator>::vector(_ForwardIterator __first, typename enable_if<__is_forward_iterator<_ForwardIterator>::value && is_constructible< value_type, - typename iterator_traits<_ForwardIterator>::reference>::value>::type*) + typename iterator_traits<_ForwardIterator>::reference>::value, + _ForwardIterator>::type __last) { #if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this); |