Hi
Thanks a lot for those explanations, very educative. I was indeed
wondering what was the additional template parameter for.
So here is a new attempt. While moving __is_transparent to std
namespace I renamed to __has_is_transparent to not conflict with
existing __is_transparent. I agree that it is another non-standard type
in the std namespace but at the same time should'nt the whole content of
stl_tree.h be in __gnu_cxx rather ? This is perhaps not a reason to make
situation worst so tell me if you want me to move it to std::__detail
namespace ?
At the beginning I wanted to make something like in bits/map.h to
not have to replicate the __is_transparent stuff. But I didn't found any
way to do such a thing.
2015-01-22 François Dumont <fdum...@gcc.gnu.org>
* include/bits/stl_tree.h (_Rb_tree<>::__is_transparent<>): Move to
outer
scope and rename in ...
(std::__hash_is_transparent<>): ... this.
* include/debug/stl_map.h (map::find<>,
map::lower_bound<>, map::upper_bound<>, map::equal_range<>): New
member function templates to perform heterogeneous lookup.
* include/debug/stl_multimap.h (multimap::find<>,
multimap::lower_bound<>, multimap::upper_bound<>,
multimap::equal_range<>): Likewise.
* include/debug/stl_multiset.h (multiset::find<>,
multiset::lower_bound<>, multiset::upper_bound<>,
multiset::equal_range<>): Likewise.
* include/debug/stl_set.h (set::find<>,
set::lower_bound<>, set::upper_bound<>, set::equal_range<>): Likewise.
* include/profile/stl_map.h (map::find<>, map::count<>,
map::lower_bound<>, map::upper_bound<>, map::equal_range<>): Likewise.
* include/profile/stl_multimap.h (multimap::find<>, multimap::cout<>,
multimap::lower_bound<>, multimap::upper_bound<>,
multimap::equal_range<>): Likewise.
* include/profile/stl_multiset.h (multiset::find<>, multiset::count<>,
multiset::lower_bound<>, multiset::upper_bound<>,
multiset::equal_range<>): Likewise.
* include/profile/stl_set.h (set::find<>, set::count<>,
set::lower_bound<>, set::upper_bound<>, set::equal_range<>): Likewise.
Tested under Linux x86_64 normal, debug and profile modes.
François
On 26/01/2015 12:19, Jonathan Wakely wrote:
On 24/01/15 22:46 +0000, Jonathan Wakely wrote:
On 24/01/15 23:03 +0100, François Dumont wrote:
types. I am also surprised that it is not using enable_if, IMHO it
makes the code clearer.
It doesn't work though.
@@ -1155,9 +1150,8 @@
return _S_iter(__y);
}
- template<typename _Kt,
- typename _Req = typename __is_transparent<_Compare,
_Kt>::type>
- iterator
+ template<typename _Kt>
+ enable_if_t<__has_is_transparent<_Compare>::value, iterator>
_M_find_tr(const _Kt& __k)
This doesn't work.
Consider:
#include <set>
struct I
{
int i;
operator int() const { return i; }
};
int main()
{
std::set<int> s;
I i = { };
s.find(i);
}
(I will add something like this to the testsuite.)
Done with this patch, tested x86_64-linux and committed to trunk.
Index: include/bits/stl_tree.h
===================================================================
--- include/bits/stl_tree.h (revision 220131)
+++ include/bits/stl_tree.h (working copy)
@@ -342,7 +342,17 @@
_Rb_tree_rebalance_for_erase(_Rb_tree_node_base* const __z,
_Rb_tree_node_base& __header) throw ();
+#if __cplusplus > 201103L
+ template<typename _Cmp, typename _Kt, typename = __void_t<>>
+ struct __has_is_transparent
+ { };
+ template<typename _Cmp, typename _Kt>
+ struct __has_is_transparent<_Cmp, _Kt,
+ __void_t<typename _Cmp::is_transparent>>
+ { typedef void type; };
+#endif
+
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc = allocator<_Val> >
class _Rb_tree
@@ -1119,14 +1129,6 @@
equal_range(const key_type& __k) const;
#if __cplusplus > 201103L
- template<typename _Cmp, typename _Kt, typename = __void_t<>>
- struct __is_transparent { };
-
- template<typename _Cmp, typename _Kt>
- struct
- __is_transparent<_Cmp, _Kt, __void_t<typename _Cmp::is_transparent>>
- { typedef void type; };
-
static auto _S_iter(_Link_type __x) { return iterator(__x); }
static auto _S_iter(_Const_Link_type __x) { return const_iterator(__x); }
@@ -1156,7 +1158,8 @@
}
template<typename _Kt,
- typename _Req = typename __is_transparent<_Compare, _Kt>::type>
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
iterator
_M_find_tr(const _Kt& __k)
{
@@ -1167,7 +1170,8 @@
}
template<typename _Kt,
- typename _Req = typename __is_transparent<_Compare, _Kt>::type>
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
const_iterator
_M_find_tr(const _Kt& __k) const
{
@@ -1178,7 +1182,8 @@
}
template<typename _Kt,
- typename _Req = typename __is_transparent<_Compare, _Kt>::type>
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
size_type
_M_count_tr(const _Kt& __k) const
{
@@ -1187,7 +1192,8 @@
}
template<typename _Kt,
- typename _Req = typename __is_transparent<_Compare, _Kt>::type>
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
iterator
_M_lower_bound_tr(const _Kt& __k)
{
@@ -1196,7 +1202,8 @@
}
template<typename _Kt,
- typename _Req = typename __is_transparent<_Compare, _Kt>::type>
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
const_iterator
_M_lower_bound_tr(const _Kt& __k) const
{
@@ -1205,7 +1212,8 @@
}
template<typename _Kt,
- typename _Req = typename __is_transparent<_Compare, _Kt>::type>
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
iterator
_M_upper_bound_tr(const _Kt& __k)
{
@@ -1214,7 +1222,8 @@
}
template<typename _Kt,
- typename _Req = typename __is_transparent<_Compare, _Kt>::type>
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
const_iterator
_M_upper_bound_tr(const _Kt& __k) const
{
@@ -1223,7 +1232,8 @@
}
template<typename _Kt,
- typename _Req = typename __is_transparent<_Compare, _Kt>::type>
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
pair<iterator, iterator>
_M_equal_range_tr(const _Kt& __k)
{
@@ -1236,7 +1246,8 @@
}
template<typename _Kt,
- typename _Req = typename __is_transparent<_Compare, _Kt>::type>
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
pair<const_iterator, const_iterator>
_M_equal_range_tr(const _Kt& __k) const
{
Index: include/debug/map.h
===================================================================
--- include/debug/map.h (revision 220131)
+++ include/debug/map.h (working copy)
@@ -412,10 +412,28 @@
find(const key_type& __x)
{ return iterator(_Base::find(__x), this); }
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ find(const _Kt& __x)
+ { return { _Base::find(__x), this }; }
+#endif
+
const_iterator
find(const key_type& __x) const
{ return const_iterator(_Base::find(__x), this); }
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ find(const _Kt& __x) const
+ { return { _Base::find(__x), this }; }
+#endif
+
using _Base::count;
iterator
@@ -422,18 +440,54 @@
lower_bound(const key_type& __x)
{ return iterator(_Base::lower_bound(__x), this); }
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ lower_bound(const _Kt& __x)
+ { return { _Base::lower_bound(__x), this }; }
+#endif
+
const_iterator
lower_bound(const key_type& __x) const
{ return const_iterator(_Base::lower_bound(__x), this); }
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ lower_bound(const _Kt& __x) const
+ { return { _Base::lower_bound(__x), this }; }
+#endif
+
iterator
upper_bound(const key_type& __x)
{ return iterator(_Base::upper_bound(__x), this); }
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ upper_bound(const _Kt& __x)
+ { return { _Base::upper_bound(__x), this }; }
+#endif
+
const_iterator
upper_bound(const key_type& __x) const
{ return const_iterator(_Base::upper_bound(__x), this); }
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ upper_bound(const _Kt& __x) const
+ { return { _Base::upper_bound(__x), this }; }
+#endif
+
std::pair<iterator,iterator>
equal_range(const key_type& __x)
{
@@ -443,6 +497,18 @@
iterator(__res.second, this));
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ std::pair<iterator, iterator>
+ equal_range(const _Kt& __x)
+ {
+ auto __res = _Base::equal_range(__x);
+ return { { __res.first, this }, { __res.second, this } };
+ }
+#endif
+
std::pair<const_iterator,const_iterator>
equal_range(const key_type& __x) const
{
@@ -452,6 +518,18 @@
const_iterator(__res.second, this));
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ std::pair<const_iterator, const_iterator>
+ equal_range(const _Kt& __x) const
+ {
+ auto __res = _Base::equal_range(__x);
+ return { { __res.first, this }, { __res.second, this } };
+ }
+#endif
+
_Base&
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
Index: include/debug/multimap.h
===================================================================
--- include/debug/multimap.h (revision 220131)
+++ include/debug/multimap.h (working copy)
@@ -393,10 +393,28 @@
find(const key_type& __x)
{ return iterator(_Base::find(__x), this); }
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ find(const _Kt& __x)
+ { return { _Base::find(__x), this }; }
+#endif
+
const_iterator
find(const key_type& __x) const
{ return const_iterator(_Base::find(__x), this); }
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ find(const _Kt& __x) const
+ { return { _Base::find(__x), this }; }
+#endif
+
using _Base::count;
iterator
@@ -403,18 +421,54 @@
lower_bound(const key_type& __x)
{ return iterator(_Base::lower_bound(__x), this); }
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ lower_bound(const _Kt& __x)
+ { return { _Base::lower_bound(__x), this }; }
+#endif
+
const_iterator
lower_bound(const key_type& __x) const
{ return const_iterator(_Base::lower_bound(__x), this); }
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ lower_bound(const _Kt& __x) const
+ { return { _Base::lower_bound(__x), this }; }
+#endif
+
iterator
upper_bound(const key_type& __x)
{ return iterator(_Base::upper_bound(__x), this); }
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ upper_bound(const _Kt& __x)
+ { return { _Base::upper_bound(__x), this }; }
+#endif
+
const_iterator
upper_bound(const key_type& __x) const
{ return const_iterator(_Base::upper_bound(__x), this); }
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ upper_bound(const _Kt& __x) const
+ { return { _Base::upper_bound(__x), this }; }
+#endif
+
std::pair<iterator,iterator>
equal_range(const key_type& __x)
{
@@ -424,6 +478,18 @@
iterator(__res.second, this));
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ std::pair<iterator, iterator>
+ equal_range(const _Kt& __x)
+ {
+ auto __res = _Base::equal_range(__x);
+ return { { __res.first, this }, { __res.second, this } };
+ }
+#endif
+
std::pair<const_iterator,const_iterator>
equal_range(const key_type& __x) const
{
@@ -433,6 +499,18 @@
const_iterator(__res.second, this));
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ std::pair<const_iterator, const_iterator>
+ equal_range(const _Kt& __x) const
+ {
+ auto __res = _Base::equal_range(__x);
+ return { { __res.first, this }, { __res.second, this } };
+ }
+#endif
+
_Base&
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
Index: include/debug/set.h
===================================================================
--- include/debug/set.h (revision 220131)
+++ include/debug/set.h (working copy)
@@ -393,6 +393,22 @@
find(const key_type& __x) const
{ return const_iterator(_Base::find(__x), this); }
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ find(const _Kt& __x)
+ { return { _Base::find(__x), this }; }
+
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ find(const _Kt& __x) const
+ { return { _Base::find(__x), this }; }
+#endif
+
using _Base::count;
iterator
@@ -405,6 +421,22 @@
lower_bound(const key_type& __x) const
{ return const_iterator(_Base::lower_bound(__x), this); }
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ lower_bound(const _Kt& __x)
+ { return { _Base::lower_bound(__x), this }; }
+
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ lower_bound(const _Kt& __x) const
+ { return { _Base::lower_bound(__x), this }; }
+#endif
+
iterator
upper_bound(const key_type& __x)
{ return iterator(_Base::upper_bound(__x), this); }
@@ -415,6 +447,22 @@
upper_bound(const key_type& __x) const
{ return const_iterator(_Base::upper_bound(__x), this); }
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ upper_bound(const _Kt& __x)
+ { return { _Base::upper_bound(__x), this }; }
+
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ upper_bound(const _Kt& __x) const
+ { return { _Base::upper_bound(__x), this }; }
+#endif
+
std::pair<iterator,iterator>
equal_range(const key_type& __x)
{
@@ -429,12 +477,34 @@
std::pair<const_iterator,const_iterator>
equal_range(const key_type& __x) const
{
- std::pair<_Base_iterator, _Base_iterator> __res =
+ std::pair<_Base_const_iterator, _Base_const_iterator> __res =
_Base::equal_range(__x);
return std::make_pair(const_iterator(__res.first, this),
const_iterator(__res.second, this));
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ std::pair<iterator, iterator>
+ equal_range(const _Kt& __x)
+ {
+ auto __res = _Base::equal_range(__x);
+ return { { __res.first, this }, { __res.second, this } };
+ }
+
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ std::pair<const_iterator, const_iterator>
+ equal_range(const _Kt& __x) const
+ {
+ auto __res = _Base::equal_range(__x);
+ return { { __res.first, this }, { __res.second, this } };
+ }
+#endif
+
_Base&
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
Index: include/debug/multiset.h
===================================================================
--- include/debug/multiset.h (revision 220131)
+++ include/debug/multiset.h (working copy)
@@ -386,6 +386,22 @@
find(const key_type& __x) const
{ return const_iterator(_Base::find(__x), this); }
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ find(const _Kt& __x)
+ { return { _Base::find(__x), this }; }
+
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ find(const _Kt& __x) const
+ { return { _Base::find(__x), this }; }
+#endif
+
using _Base::count;
iterator
@@ -398,6 +414,22 @@
lower_bound(const key_type& __x) const
{ return const_iterator(_Base::lower_bound(__x), this); }
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ lower_bound(const _Kt& __x)
+ { return { _Base::lower_bound(__x), this }; }
+
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ lower_bound(const _Kt& __x) const
+ { return { _Base::lower_bound(__x), this }; }
+#endif
+
iterator
upper_bound(const key_type& __x)
{ return iterator(_Base::upper_bound(__x), this); }
@@ -408,6 +440,22 @@
upper_bound(const key_type& __x) const
{ return const_iterator(_Base::upper_bound(__x), this); }
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ upper_bound(const _Kt& __x)
+ { return { _Base::upper_bound(__x), this }; }
+
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ upper_bound(const _Kt& __x) const
+ { return { _Base::upper_bound(__x), this }; }
+#endif
+
std::pair<iterator,iterator>
equal_range(const key_type& __x)
{
@@ -428,6 +476,28 @@
const_iterator(__res.second, this));
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ std::pair<iterator, iterator>
+ equal_range(const _Kt& __x)
+ {
+ auto __res = _Base::equal_range(__x);
+ return { { __res.first, this }, { __res.second, this } };
+ }
+
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ std::pair<const_iterator, const_iterator>
+ equal_range(const _Kt& __x) const
+ {
+ auto __res = _Base::equal_range(__x);
+ return { { __res.first, this }, { __res.second, this } };
+ }
+#endif
+
_Base&
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
Index: include/profile/map.h
===================================================================
--- include/profile/map.h (revision 220131)
+++ include/profile/map.h (working copy)
@@ -429,6 +429,18 @@
return iterator(_Base::find(__x), this);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ find(const _Kt& __x)
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ return { _Base::find(__x), this };
+ }
+#endif
+
const_iterator
find(const key_type& __x) const
{
@@ -436,6 +448,18 @@
return const_iterator(_Base::find(__x), this);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ find(const _Kt& __x) const
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ return { _Base::find(__x), this };
+ }
+#endif
+
size_type
count(const key_type& __x) const
{
@@ -443,6 +467,18 @@
return _Base::count(__x);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ size_type
+ count(const _Kt& __x) const
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ return _Base::count(__x);
+ }
+#endif
+
iterator
lower_bound(const key_type& __x)
{
@@ -451,6 +487,19 @@
return iterator(_Base::lower_bound(__x), this);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ lower_bound(const _Kt& __x)
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ __profcxx_map2umap_invalidate(this->_M_map2umap_info);
+ return { _Base::lower_bound(__x), this };
+ }
+#endif
+
const_iterator
lower_bound(const key_type& __x) const
{
@@ -459,6 +508,19 @@
return const_iterator(_Base::lower_bound(__x), this);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ lower_bound(const _Kt& __x) const
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ __profcxx_map2umap_invalidate(this->_M_map2umap_info);
+ return { _Base::lower_bound(__x), this };
+ }
+#endif
+
iterator
upper_bound(const key_type& __x)
{
@@ -467,6 +529,19 @@
return iterator(_Base::upper_bound(__x), this);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ upper_bound(const _Kt& __x)
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ __profcxx_map2umap_invalidate(this->_M_map2umap_info);
+ return { _Base::upper_bound(__x), this };
+ }
+#endif
+
const_iterator
upper_bound(const key_type& __x) const
{
@@ -475,6 +550,19 @@
return const_iterator(_Base::upper_bound(__x), this);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ upper_bound(const _Kt& __x) const
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ __profcxx_map2umap_invalidate(this->_M_map2umap_info);
+ return { _Base::upper_bound(__x), this };
+ }
+#endif
+
std::pair<iterator,iterator>
equal_range(const key_type& __x)
{
@@ -485,6 +573,19 @@
iterator(__base_ret.second, this));
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ std::pair<iterator, iterator>
+ equal_range(const _Kt& __x)
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ auto __res = _Base::equal_range(__x);
+ return { { __res.first, this }, { __res.second, this } };
+ }
+#endif
+
std::pair<const_iterator,const_iterator>
equal_range(const key_type& __x) const
{
@@ -495,6 +596,19 @@
const_iterator(__base_ret.second, this));
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ std::pair<const_iterator, const_iterator>
+ equal_range(const _Kt& __x) const
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ auto __res = _Base::equal_range(__x);
+ return { { __res.first, this }, { __res.second, this } };
+ }
+#endif
+
_Base&
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
Index: include/profile/multimap.h
===================================================================
--- include/profile/multimap.h (revision 220131)
+++ include/profile/multimap.h (working copy)
@@ -388,6 +388,18 @@
return iterator(_Base::find(__x), this);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ find(const _Kt& __x)
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ return { _Base::find(__x), this };
+ }
+#endif
+
const_iterator
find(const key_type& __x) const
{
@@ -395,6 +407,18 @@
return const_iterator(_Base::find(__x), this);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ find(const _Kt& __x) const
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ return { _Base::find(__x), this };
+ }
+#endif
+
size_type
count(const key_type& __x) const
{
@@ -402,6 +426,18 @@
return _Base::count(__x);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ size_type
+ count(const _Kt& __x) const
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ return _Base::count(__x);
+ }
+#endif
+
iterator
lower_bound(const key_type& __x)
{
@@ -410,6 +446,19 @@
return iterator(_Base::lower_bound(__x), this);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ lower_bound(const _Kt& __x)
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ __profcxx_map2umap_invalidate(this->_M_map2umap_info);
+ return { _Base::lower_bound(__x), this };
+ }
+#endif
+
const_iterator
lower_bound(const key_type& __x) const
{
@@ -418,6 +467,19 @@
return const_iterator(_Base::lower_bound(__x), this);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ lower_bound(const _Kt& __x) const
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ __profcxx_map2umap_invalidate(this->_M_map2umap_info);
+ return { _Base::lower_bound(__x), this };
+ }
+#endif
+
iterator
upper_bound(const key_type& __x)
{
@@ -426,6 +488,19 @@
return iterator(_Base::upper_bound(__x), this);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ upper_bound(const _Kt& __x)
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ __profcxx_map2umap_invalidate(this->_M_map2umap_info);
+ return { _Base::upper_bound(__x), this };
+ }
+#endif
+
const_iterator
upper_bound(const key_type& __x) const
{
@@ -434,6 +509,19 @@
return const_iterator(_Base::upper_bound(__x), this);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ upper_bound(const _Kt& __x) const
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ __profcxx_map2umap_invalidate(this->_M_map2umap_info);
+ return { _Base::upper_bound(__x), this };
+ }
+#endif
+
std::pair<iterator,iterator>
equal_range(const key_type& __x)
{
@@ -444,6 +532,19 @@
iterator(__base_ret.second, this));
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ std::pair<iterator, iterator>
+ equal_range(const _Kt& __x)
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ auto __res = _Base::equal_range(__x);
+ return { { __res.first, this }, { __res.second, this } };
+ }
+#endif
+
std::pair<const_iterator,const_iterator>
equal_range(const key_type& __x) const
{
@@ -454,6 +555,19 @@
const_iterator(__base_ret.second, this));
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ std::pair<const_iterator, const_iterator>
+ equal_range(const _Kt& __x) const
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ auto __res = _Base::equal_range(__x);
+ return { { __res.first, this }, { __res.second, this } };
+ }
+#endif
+
_Base&
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
Index: include/profile/multiset.h
===================================================================
--- include/profile/multiset.h (revision 220131)
+++ include/profile/multiset.h (working copy)
@@ -379,6 +379,18 @@
return _Base::count(__x);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ size_type
+ count(const _Kt& __x) const
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ return _Base::count(__x);
+ }
+#endif
+
// multiset operations:
iterator
find(const key_type& __x)
@@ -396,6 +408,28 @@
return const_iterator(_Base::find(__x), this);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ find(const _Kt& __x)
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ return { _Base::find(__x), this };
+ }
+
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ find(const _Kt& __x) const
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ return { _Base::find(__x), this };
+ }
+#endif
+
iterator
lower_bound(const key_type& __x)
{
@@ -413,6 +447,30 @@
return const_iterator(_Base::lower_bound(__x), this);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ lower_bound(const _Kt& __x)
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ __profcxx_map2umap_invalidate(this->_M_map2umap_info);
+ return { _Base::lower_bound(__x), this };
+ }
+
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ lower_bound(const _Kt& __x) const
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ __profcxx_map2umap_invalidate(this->_M_map2umap_info);
+ return { _Base::lower_bound(__x), this };
+ }
+#endif
+
iterator
upper_bound(const key_type& __x)
{
@@ -431,6 +489,30 @@
return const_iterator(_Base::upper_bound(__x), this);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ upper_bound(const _Kt& __x)
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ __profcxx_map2umap_invalidate(this->_M_map2umap_info);
+ return { _Base::upper_bound(__x), this };
+ }
+
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ upper_bound(const _Kt& __x) const
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ __profcxx_map2umap_invalidate(this->_M_map2umap_info);
+ return { _Base::upper_bound(__x), this };
+ }
+#endif
+
std::pair<iterator,iterator>
equal_range(const key_type& __x)
{
@@ -453,6 +535,30 @@
const_iterator(__base_ret.second, this));
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ std::pair<iterator, iterator>
+ equal_range(const _Kt& __x)
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ auto __res = _Base::equal_range(__x);
+ return { { __res.first, this }, { __res.second, this } };
+ }
+
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ std::pair<const_iterator, const_iterator>
+ equal_range(const _Kt& __x) const
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ auto __res = _Base::equal_range(__x);
+ return { { __res.first, this }, { __res.second, this } };
+ }
+#endif
+
_Base&
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
Index: include/profile/set.h
===================================================================
--- include/profile/set.h (revision 220131)
+++ include/profile/set.h (working copy)
@@ -369,6 +369,18 @@
return _Base::count(__x);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ size_type
+ count(const _Kt& __x) const
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ return _Base::count(__x);
+ }
+#endif
+
// set operations:
iterator
find(const key_type& __x)
@@ -384,6 +396,28 @@
return const_iterator(_Base::find(__x), this);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ find(const _Kt& __x)
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ return { _Base::find(__x), this };
+ }
+
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ find(const _Kt& __x) const
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ return { _Base::find(__x), this };
+ }
+#endif
+
iterator
lower_bound(const key_type& __x)
{
@@ -400,6 +434,30 @@
return const_iterator(_Base::lower_bound(__x), this);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ lower_bound(const _Kt& __x)
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ __profcxx_map2umap_invalidate(this->_M_map2umap_info);
+ return { _Base::lower_bound(__x), this };
+ }
+
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ lower_bound(const _Kt& __x) const
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ __profcxx_map2umap_invalidate(this->_M_map2umap_info);
+ return { _Base::lower_bound(__x), this };
+ }
+#endif
+
iterator
upper_bound(const key_type& __x)
{
@@ -416,6 +474,30 @@
return const_iterator(_Base::upper_bound(__x), this);
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ iterator
+ upper_bound(const _Kt& __x)
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ __profcxx_map2umap_invalidate(this->_M_map2umap_info);
+ return { _Base::upper_bound(__x), this };
+ }
+
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ const_iterator
+ upper_bound(const _Kt& __x) const
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ __profcxx_map2umap_invalidate(this->_M_map2umap_info);
+ return { _Base::upper_bound(__x), this };
+ }
+#endif
+
std::pair<iterator, iterator>
equal_range(const key_type& __x)
{
@@ -436,6 +518,30 @@
const_iterator(__base_ret.second, this));
}
+#if __cplusplus > 201103L
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ std::pair<iterator, iterator>
+ equal_range(const _Kt& __x)
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ auto __res = _Base::equal_range(__x);
+ return { { __res.first, this }, { __res.second, this } };
+ }
+
+ template<typename _Kt,
+ typename _Req =
+ typename __has_is_transparent<_Compare, _Kt>::type>
+ std::pair<const_iterator, const_iterator>
+ equal_range(const _Kt& __x) const
+ {
+ __profcxx_map2umap_find(this->_M_map2umap_info, this->size());
+ auto __res = _Base::equal_range(__x);
+ return { { __res.first, this }, { __res.second, this } };
+ }
+#endif
+
_Base&
_M_base() _GLIBCXX_NOEXCEPT { return *this; }