[patch] [C++14] Implement N3657: heterogeneous lookup in associative containers.
François Dumont
frs.dumont@gmail.com
Sat Jan 24 22:04:00 GMT 2015
Sorry, I hadn't notice the condition to expose the new methods. It was
hidden within the _Rb_tree type that I hadn't check (and I do not often
check the Standard directly for my limited patches).
On my side I am surprised you didn't reuse your code to detect member
types. I am also surprised that it is not using enable_if, IMHO it makes
the code clearer. Here is a proposal to use both extended to the debug
mode too.
François
On 22/01/2015 03:07, Jonathan Wakely wrote:
> On 21/01/15 23:30 +0100, François Dumont wrote:
>> +#if __cplusplus > 201103L
>> + template<typename _Kt>
>> + std::pair<iterator, iterator>
>> + equal_range(const _Kt& __x)
>> + {
>> + std::pair<_Base_iterator, _Base_iterator> __res =
>> + _Base::equal_range(__x);
>> + return std::make_pair(iterator(__res.first, this),
>> + iterator(__res.second, this));
>> + }
>
> BTW, this is C++14 code, what's wrong with:
>
> template<typename _Kt>
> std::pair<const_iterator, const_iterator>
> equal_range(const _Kt& __x) const
> {
> auto __res = _Base::equal_range(__x);
> return { iterator(__res.first, this), iterator(__res.second,
> this) };
> }
>
> Or even:
>
> template<typename _Kt>
> 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} };
> }
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: asso_cont.patch
Type: text/x-patch
Size: 16682 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20150124/9fa2a7d2/attachment.bin>
More information about the Libstdc++
mailing list