Index: include/deque =================================================================== --- include/deque +++ include/deque @@ -128,6 +128,10 @@ void clear() noexcept; }; +template ::value_type>> + deque(InputIterator, InputIterator, Allocator = Allocator()) + -> deque::value_type, Allocator>; + template bool operator==(const deque& x, const deque& y); template @@ -1461,6 +1465,23 @@ void __move_assign(deque& __c, false_type); }; +#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES +template::value_type>, + class = typename enable_if<__is_allocator<_Alloc>::value, void>::type + > +deque(_InputIterator, _InputIterator) + -> deque::value_type, _Alloc>; + +template::value, void>::type + > +deque(_InputIterator, _InputIterator, _Alloc) + -> deque::value_type, _Alloc>; +#endif + + template deque<_Tp, _Allocator>::deque(size_type __n) { Index: test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp =================================================================== --- test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp +++ test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// +// UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: libcpp-no-deduction-guides + + +// template ::value_type>> +// deque(InputIterator, InputIterator, Allocator = Allocator()) +// -> deque::value_type, Allocator>; +// + + +#include +#include +#include +#include +#include // INT_MAX + +#include "test_macros.h" +#include "test_iterators.h" + + +int main() +{ + + { + const int arr[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + std::deque deq(std::begin(arr), std::end(arr)); + + static_assert(std::is_same_v>, ""); + assert(std::equal(deq.begin(), deq.end(), std::begin(arr), std::end(arr))); + } + + { + const long arr[] = {INT_MAX, 1L + INT_MAX, 2L, 3L }; + std::deque deq(std::begin(arr), std::end(arr), std::allocator()); + static_assert(std::is_same_v, ""); + assert(deq.size() == 4); + assert(deq[0] == INT_MAX); + assert(deq[1] == 1L + INT_MAX); + assert(deq[2] == 2L); + } +}