diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2014-03-05 19:06:20 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2014-03-05 19:06:20 +0000 |
commit | 48c74700ec233e7b9ac0c1f06215cd443424cb62 (patch) | |
tree | e8754484aa27ff1c9f7618e970567e86201d95ba /include | |
parent | 24b29a02f193db6437289e24fbe09fbf7b4bcfcb (diff) |
Implement LWG 2193. Default constructors for standard library containers are explicit. Note that libc++ already did this for string/deque/forward_list/list/vector and the unordered containers; implement it for set/multiset/map/multimap. Add tests for all the containers. Two drive-by fixes as well: add a missing explicit in <deque>, and remove a tab that snuck into a container test. This issue is also LLVM bug 15724, and resolves it.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202994 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/deque | 2 | ||||
-rw-r--r-- | include/map | 4 | ||||
-rw-r--r-- | include/set | 8 |
3 files changed, 7 insertions, 7 deletions
diff --git a/include/deque b/include/deque index f099000b1..9b256b74d 100644 --- a/include/deque +++ b/include/deque @@ -1208,7 +1208,7 @@ public: deque() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) {} - _LIBCPP_INLINE_VISIBILITY deque(const allocator_type& __a) : __base(__a) {} + _LIBCPP_INLINE_VISIBILITY explicit deque(const allocator_type& __a) : __base(__a) {} explicit deque(size_type __n); #if _LIBCPP_STD_VER > 11 explicit deque(size_type __n, const _Allocator& __a); diff --git a/include/map b/include/map index 9779b70e2..16127a5d7 100644 --- a/include/map +++ b/include/map @@ -835,7 +835,7 @@ public: typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; _LIBCPP_INLINE_VISIBILITY - explicit map(const key_compare& __comp = key_compare()) + map(const key_compare& __comp = key_compare()) _NOEXCEPT_( is_nothrow_default_constructible<allocator_type>::value && is_nothrow_default_constructible<key_compare>::value && @@ -1568,7 +1568,7 @@ public: typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; _LIBCPP_INLINE_VISIBILITY - explicit multimap(const key_compare& __comp = key_compare()) + multimap(const key_compare& __comp = key_compare()) _NOEXCEPT_( is_nothrow_default_constructible<allocator_type>::value && is_nothrow_default_constructible<key_compare>::value && diff --git a/include/set b/include/set index a537c5fe3..f093b1896 100644 --- a/include/set +++ b/include/set @@ -425,14 +425,14 @@ public: typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; _LIBCPP_INLINE_VISIBILITY - explicit set(const value_compare& __comp = value_compare()) + set(const value_compare& __comp = value_compare()) _NOEXCEPT_( is_nothrow_default_constructible<allocator_type>::value && is_nothrow_default_constructible<key_compare>::value && is_nothrow_copy_constructible<key_compare>::value) : __tree_(__comp) {} _LIBCPP_INLINE_VISIBILITY - set(const value_compare& __comp, const allocator_type& __a) + explicit set(const value_compare& __comp, const allocator_type& __a) : __tree_(__comp, __a) {} template <class _InputIterator> _LIBCPP_INLINE_VISIBILITY @@ -822,14 +822,14 @@ public: // construct/copy/destroy: _LIBCPP_INLINE_VISIBILITY - explicit multiset(const value_compare& __comp = value_compare()) + multiset(const value_compare& __comp = value_compare()) _NOEXCEPT_( is_nothrow_default_constructible<allocator_type>::value && is_nothrow_default_constructible<key_compare>::value && is_nothrow_copy_constructible<key_compare>::value) : __tree_(__comp) {} _LIBCPP_INLINE_VISIBILITY - multiset(const value_compare& __comp, const allocator_type& __a) + explicit multiset(const value_compare& __comp, const allocator_type& __a) : __tree_(__comp, __a) {} template <class _InputIterator> _LIBCPP_INLINE_VISIBILITY |