[libcxx-commits] [PATCH] D115977: [libc++] Implement P1425R4 (Iterator pair constructors for std::stack and std::queue)

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Dec 18 09:43:29 PST 2021


Quuxplusone added inline comments.


================
Comment at: libcxx/include/queue:397-404
+#if _LIBCPP_STD_VER > 20
+template <class _InputIterator>
+queue(_InputIterator, _InputIterator) -> queue<__iter_value_type<_InputIterator>>;
+
+template <class _InputIterator, class _Alloc>
+queue(_InputIterator, _InputIterator, _Alloc)
+  -> queue<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>;
----------------
Yipes, almost missed this, except that the failing CI alerted me. All these deduction guides need to use `__enable_if_t` to disable themselves when `_InputIterator` is not an iterator or `_Alloc` is not an allocator. Look at the guides for `deque` or `priority_queue` and do as they do.

Please also add some `SFINAES_away` tests to `deduct.pass.cpp` proving that the deduction guides indeed SFINAE away in those cases.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115977/new/

https://reviews.llvm.org/D115977



More information about the libcxx-commits mailing list