diff options
| author | Marshall Clow <mclow.lists@gmail.com> | 2013-08-13 01:11:06 +0000 |
|---|---|---|
| committer | Marshall Clow <mclow.lists@gmail.com> | 2013-08-13 01:11:06 +0000 |
| commit | 25d3402c6a595cdf5555a82de0eee8d8a58df25a (patch) | |
| tree | ad70a64b9844d4991098591286de6b47a3f84a11 /libcxx/include/set | |
| parent | f09a3dbf92b0f9b0c041a80f862147b03237ce1e (diff) | |
| download | bcm5719-llvm-25d3402c6a595cdf5555a82de0eee8d8a58df25a.tar.gz bcm5719-llvm-25d3402c6a595cdf5555a82de0eee8d8a58df25a.zip | |
First half of support for N3657; heterogenous lookups for set/multiset
llvm-svn: 188241
Diffstat (limited to 'libcxx/include/set')
| -rw-r--r-- | libcxx/include/set | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/libcxx/include/set b/libcxx/include/set index d714c1ac1c3..70b8d28f7e5 100644 --- a/libcxx/include/set +++ b/libcxx/include/set @@ -129,13 +129,33 @@ public: // set operations: iterator find(const key_type& k); const_iterator find(const key_type& k) const; + template<typename K> + iterator find(const K& x); + template<typename K> + const_iterator find(const K& x) const; // C++14 + template<typename K> + size_type count(const K& x) const; // C++14 + size_type count(const key_type& k) const; iterator lower_bound(const key_type& k); const_iterator lower_bound(const key_type& k) const; + template<typename K> + iterator lower_bound(const K& x); // C++14 + template<typename K> + const_iterator lower_bound(const K& x) const; // C++14 + iterator upper_bound(const key_type& k); const_iterator upper_bound(const key_type& k) const; + template<typename K> + iterator upper_bound(const K& x); // C++14 + template<typename K> + const_iterator upper_bound(const K& x) const; // C++14 pair<iterator,iterator> equal_range(const key_type& k); pair<const_iterator,const_iterator> equal_range(const key_type& k) const; + template<typename K> + pair<iterator,iterator> equal_range(const K& x); // C++14 + template<typename K> + pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14 }; template <class Key, class Compare, class Allocator> @@ -285,13 +305,32 @@ public: // set operations: iterator find(const key_type& k); const_iterator find(const key_type& k) const; + template<typename K> + iterator find(const K& x); + template<typename K> + const_iterator find(const K& x) const; // C++14 + size_type count(const key_type& k) const; iterator lower_bound(const key_type& k); const_iterator lower_bound(const key_type& k) const; + template<typename K> + iterator lower_bound(const K& x); // C++14 + template<typename K> + const_iterator lower_bound(const K& x) const; // C++14 + iterator upper_bound(const key_type& k); const_iterator upper_bound(const key_type& k) const; + template<typename K> + iterator upper_bound(const K& x); // C++14 + template<typename K> + const_iterator upper_bound(const K& x) const; // C++14 + pair<iterator,iterator> equal_range(const key_type& k); pair<const_iterator,const_iterator> equal_range(const key_type& k) const; + template<typename K> + pair<iterator,iterator> equal_range(const K& x); // C++14 + template<typename K> + pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14 }; template <class Key, class Compare, class Allocator> @@ -579,6 +618,17 @@ public: iterator find(const key_type& __k) {return __tree_.find(__k);} _LIBCPP_INLINE_VISIBILITY const_iterator find(const key_type& __k) const {return __tree_.find(__k);} +#if _LIBCPP_STD_VER > 11 + template <typename _K2> + _LIBCPP_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type + find(const _K2& __k) {return __tree_.find(__k);} + template <typename _K2> + _LIBCPP_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type + find(const _K2& __k) const {return __tree_.find(__k);} +#endif + _LIBCPP_INLINE_VISIBILITY size_type count(const key_type& __k) const {return __tree_.__count_unique(__k);} @@ -588,18 +638,51 @@ public: _LIBCPP_INLINE_VISIBILITY const_iterator lower_bound(const key_type& __k) const {return __tree_.lower_bound(__k);} +#if _LIBCPP_STD_VER > 11 + template <typename _K2> + _LIBCPP_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type + lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);} + + template <typename _K2> + _LIBCPP_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type + lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);} +#endif + _LIBCPP_INLINE_VISIBILITY iterator upper_bound(const key_type& __k) {return __tree_.upper_bound(__k);} _LIBCPP_INLINE_VISIBILITY const_iterator upper_bound(const key_type& __k) const {return __tree_.upper_bound(__k);} +#if _LIBCPP_STD_VER > 11 + template <typename _K2> + _LIBCPP_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type + upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);} + template <typename _K2> + _LIBCPP_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type + upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);} +#endif + _LIBCPP_INLINE_VISIBILITY pair<iterator,iterator> equal_range(const key_type& __k) {return __tree_.__equal_range_unique(__k);} _LIBCPP_INLINE_VISIBILITY pair<const_iterator,const_iterator> equal_range(const key_type& __k) const {return __tree_.__equal_range_unique(__k);} +#if _LIBCPP_STD_VER > 11 + template <typename _K2> + _LIBCPP_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type + equal_range(const _K2& __k) {return __tree_.__equal_range_unique(__k);} + template <typename _K2> + _LIBCPP_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type + equal_range(const _K2& __k) const {return __tree_.__equal_range_unique(__k);} +#endif }; #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -917,27 +1000,72 @@ public: iterator find(const key_type& __k) {return __tree_.find(__k);} _LIBCPP_INLINE_VISIBILITY const_iterator find(const key_type& __k) const {return __tree_.find(__k);} +#if _LIBCPP_STD_VER > 11 + template <typename _K2> + _LIBCPP_INLINE_VISIBILITY + typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type + find(const _K2& __k) {return __tree_.find(__k);} + template <typename _K2> + _LIBCPP_INLINE_VISIBILITY + typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type + find(const _K2& __k) const {return __tree_.find(__k);} +#endif + _LIBCPP_INLINE_VISIBILITY size_type count(const key_type& __k) const {return __tree_.__count_multi(__k);} + _LIBCPP_INLINE_VISIBILITY iterator lower_bound(const key_type& __k) {return __tree_.lower_bound(__k);} _LIBCPP_INLINE_VISIBILITY const_iterator lower_bound(const key_type& __k) const {return __tree_.lower_bound(__k);} +#if _LIBCPP_STD_VER > 11 + template <typename _K2> + _LIBCPP_INLINE_VISIBILITY + typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type + lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);} + + template <typename _K2> + _LIBCPP_INLINE_VISIBILITY + typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type + lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);} +#endif + _LIBCPP_INLINE_VISIBILITY iterator upper_bound(const key_type& __k) {return __tree_.upper_bound(__k);} _LIBCPP_INLINE_VISIBILITY const_iterator upper_bound(const key_type& __k) const {return __tree_.upper_bound(__k);} +#if _LIBCPP_STD_VER > 11 + template <typename _K2> + _LIBCPP_INLINE_VISIBILITY + typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type + upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);} + template <typename _K2> + _LIBCPP_INLINE_VISIBILITY + typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type + upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);} +#endif + _LIBCPP_INLINE_VISIBILITY pair<iterator,iterator> equal_range(const key_type& __k) {return __tree_.__equal_range_multi(__k);} _LIBCPP_INLINE_VISIBILITY pair<const_iterator,const_iterator> equal_range(const key_type& __k) const {return __tree_.__equal_range_multi(__k);} +#if _LIBCPP_STD_VER > 11 + template <typename _K2> + _LIBCPP_INLINE_VISIBILITY + typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type + equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} + template <typename _K2> + _LIBCPP_INLINE_VISIBILITY + typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type + equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} +#endif }; #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |

