libstdc++: Fix _OutputIteratorConcept checks in algorithms
The _OutputIteratorConcept should be checked using the correct value category. The std::move_backward and std::copy_backward algorithms should use _OutputIteratorConcept instead of _ConvertibleConcept. In order to use the correct value category, the concept should use a function that returns _ValueT instead of using an lvalue data member. Signed-off-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/bits/boost_concept_check.h (_OutputIteratorConcept): Use a function to preserve value category of the type. * include/bits/stl_algobase.h (copy, move, fill_n): Use a reference as the second argument for _OutputIteratorConcept. (copy_backward, move_backward): Use _OutputIteratorConcept instead of _ConvertibleConcept.
This commit is contained in:
parent
82626be2d6
commit
45a8cd2569
@ -464,10 +464,10 @@ struct _Aux_require_same<_Tp,_Tp> { typedef _Tp _Type; };
|
|||||||
__function_requires< _AssignableConcept<_Tp> >();
|
__function_requires< _AssignableConcept<_Tp> >();
|
||||||
++__i; // require preincrement operator
|
++__i; // require preincrement operator
|
||||||
__i++; // require postincrement operator
|
__i++; // require postincrement operator
|
||||||
*__i++ = __t; // require postincrement and assignment
|
*__i++ = __val(); // require postincrement and assignment
|
||||||
}
|
}
|
||||||
_Tp __i;
|
_Tp __i;
|
||||||
_ValueT __t;
|
_ValueT __val() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
|
@ -613,7 +613,7 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
|
|||||||
// concept requirements
|
// concept requirements
|
||||||
__glibcxx_function_requires(_InputIteratorConcept<_II>)
|
__glibcxx_function_requires(_InputIteratorConcept<_II>)
|
||||||
__glibcxx_function_requires(_OutputIteratorConcept<_OI,
|
__glibcxx_function_requires(_OutputIteratorConcept<_OI,
|
||||||
typename iterator_traits<_II>::value_type>)
|
typename iterator_traits<_II>::reference>)
|
||||||
__glibcxx_requires_can_increment_range(__first, __last, __result);
|
__glibcxx_requires_can_increment_range(__first, __last, __result);
|
||||||
|
|
||||||
return std::__copy_move_a<__is_move_iterator<_II>::__value>
|
return std::__copy_move_a<__is_move_iterator<_II>::__value>
|
||||||
@ -646,7 +646,7 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
|
|||||||
// concept requirements
|
// concept requirements
|
||||||
__glibcxx_function_requires(_InputIteratorConcept<_II>)
|
__glibcxx_function_requires(_InputIteratorConcept<_II>)
|
||||||
__glibcxx_function_requires(_OutputIteratorConcept<_OI,
|
__glibcxx_function_requires(_OutputIteratorConcept<_OI,
|
||||||
typename iterator_traits<_II>::value_type>)
|
typename iterator_traits<_II>::value_type&&>)
|
||||||
__glibcxx_requires_can_increment_range(__first, __last, __result);
|
__glibcxx_requires_can_increment_range(__first, __last, __result);
|
||||||
|
|
||||||
return std::__copy_move_a<true>(std::__miter_base(__first),
|
return std::__copy_move_a<true>(std::__miter_base(__first),
|
||||||
@ -850,9 +850,8 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
|
|||||||
// concept requirements
|
// concept requirements
|
||||||
__glibcxx_function_requires(_BidirectionalIteratorConcept<_BI1>)
|
__glibcxx_function_requires(_BidirectionalIteratorConcept<_BI1>)
|
||||||
__glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<_BI2>)
|
__glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<_BI2>)
|
||||||
__glibcxx_function_requires(_ConvertibleConcept<
|
__glibcxx_function_requires(_OutputIteratorConcept<_BI2,
|
||||||
typename iterator_traits<_BI1>::value_type,
|
typename iterator_traits<_BI1>::reference>)
|
||||||
typename iterator_traits<_BI2>::value_type>)
|
|
||||||
__glibcxx_requires_can_decrement_range(__first, __last, __result);
|
__glibcxx_requires_can_decrement_range(__first, __last, __result);
|
||||||
|
|
||||||
return std::__copy_move_backward_a<__is_move_iterator<_BI1>::__value>
|
return std::__copy_move_backward_a<__is_move_iterator<_BI1>::__value>
|
||||||
@ -886,9 +885,8 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
|
|||||||
// concept requirements
|
// concept requirements
|
||||||
__glibcxx_function_requires(_BidirectionalIteratorConcept<_BI1>)
|
__glibcxx_function_requires(_BidirectionalIteratorConcept<_BI1>)
|
||||||
__glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<_BI2>)
|
__glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<_BI2>)
|
||||||
__glibcxx_function_requires(_ConvertibleConcept<
|
__glibcxx_function_requires(_OutputIteratorConcept<_BI2,
|
||||||
typename iterator_traits<_BI1>::value_type,
|
typename iterator_traits<_BI1>::value_type&&>)
|
||||||
typename iterator_traits<_BI2>::value_type>)
|
|
||||||
__glibcxx_requires_can_decrement_range(__first, __last, __result);
|
__glibcxx_requires_can_decrement_range(__first, __last, __result);
|
||||||
|
|
||||||
return std::__copy_move_backward_a<true>(std::__miter_base(__first),
|
return std::__copy_move_backward_a<true>(std::__miter_base(__first),
|
||||||
@ -1144,7 +1142,7 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
|
|||||||
fill_n(_OI __first, _Size __n, const _Tp& __value)
|
fill_n(_OI __first, _Size __n, const _Tp& __value)
|
||||||
{
|
{
|
||||||
// concept requirements
|
// concept requirements
|
||||||
__glibcxx_function_requires(_OutputIteratorConcept<_OI, _Tp>)
|
__glibcxx_function_requires(_OutputIteratorConcept<_OI, const _Tp&>)
|
||||||
|
|
||||||
return std::__fill_n_a(__first, std::__size_to_integer(__n), __value,
|
return std::__fill_n_a(__first, std::__size_to_integer(__n), __value,
|
||||||
std::__iterator_category(__first));
|
std::__iterator_category(__first));
|
||||||
|
Loading…
Reference in New Issue
Block a user