LWG Issue 2210 (Part #2 & #3): list and forward_list
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@190279 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/list b/include/list
index 7827b96..f37cffd 100644
--- a/include/list
+++ b/include/list
@@ -40,6 +40,7 @@
noexcept(is_nothrow_default_constructible<allocator_type>::value);
explicit list(const allocator_type& a);
explicit list(size_type n);
+ explicit list(size_type n, const Allocator& a); // C++14
list(size_type n, const value_type& value);
list(size_type n, const value_type& value, const allocator_type& a);
template <class Iter>
@@ -842,13 +843,16 @@
#endif
}
_LIBCPP_INLINE_VISIBILITY
- list(const allocator_type& __a) : base(__a)
+ explicit list(const allocator_type& __a) : base(__a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
}
- list(size_type __n);
+ explicit list(size_type __n);
+#if _LIBCPP_STD_VER > 11
+ explicit list(size_type __n, const allocator_type& __a);
+#endif
list(size_type __n, const value_type& __x);
list(size_type __n, const value_type& __x, const allocator_type& __a);
template <class _InpIter>
@@ -1100,6 +1104,22 @@
#endif
}
+#if _LIBCPP_STD_VER > 11
+template <class _Tp, class _Alloc>
+list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ __get_db()->__insert_c(this);
+#endif
+ for (; __n > 0; --__n)
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ emplace_back();
+#else
+ push_back(value_type());
+#endif
+}
+#endif
+
template <class _Tp, class _Alloc>
list<_Tp, _Alloc>::list(size_type __n, const value_type& __x)
{