mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-20 01:25:03 +08:00
libstdc++: Fix std::stack deduction guide
libstdc++-v3/ChangeLog: * include/bits/stl_stack.h (stack(Iterator, Iterator)): Remove non-deducible template parameter from deduction guide. * testsuite/23_containers/stack/deduction.cc: Check new C++23 deduction guides.
This commit is contained in:
parent
82b2e4f8cf
commit
c4ecb11e4f
@ -322,7 +322,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
-> stack<typename _Container::value_type, _Container>;
|
-> stack<typename _Container::value_type, _Container>;
|
||||||
|
|
||||||
#ifdef __cpp_lib_adaptor_iterator_pair_constructor
|
#ifdef __cpp_lib_adaptor_iterator_pair_constructor
|
||||||
template<typename _InputIterator, typename _Allocator,
|
template<typename _InputIterator,
|
||||||
typename _ValT
|
typename _ValT
|
||||||
= typename iterator_traits<_InputIterator>::value_type,
|
= typename iterator_traits<_InputIterator>::value_type,
|
||||||
typename = _RequireInputIter<_InputIterator>>
|
typename = _RequireInputIter<_InputIterator>>
|
||||||
|
@ -87,3 +87,17 @@ test02()
|
|||||||
std::stack s8(std::move(l), l.get_allocator());
|
std::stack s8(std::move(l), l.get_allocator());
|
||||||
check_type<std::stack<long, std::list<long>>>(s8);
|
check_type<std::stack<long, std::list<long>>>(s8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if __cpp_lib_adaptor_iterator_pair_constructor
|
||||||
|
void
|
||||||
|
test03()
|
||||||
|
{
|
||||||
|
std::list<long> l;
|
||||||
|
|
||||||
|
std::stack s1(l.begin(), l.end());
|
||||||
|
check_type<std::stack<long>>(s1);
|
||||||
|
|
||||||
|
std::stack s2(l.begin(), l.end(), std::allocator<long>());
|
||||||
|
check_type<std::stack<long>>(s1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user