[patch] [C++14] Implement N3657: heterogeneous lookup in associative containers.

Jonathan Wakely jwakely@redhat.com
Mon Jan 26 12:11:00 GMT 2015


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 1021 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150126/578dad03/attachment.bin>


More information about the Gcc-patches mailing list