This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] [C++14] Implement N3657: heterogeneous lookup in associative containers.
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: François Dumont <frs dot dumont at gmail dot com>
- Cc: libstdc++ at gcc dot gnu dot org, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 22 Jan 2015 02:07:27 +0000
- Subject: Re: [patch] [C++14] Implement N3657: heterogeneous lookup in associative containers.
- Authentication-results: sourceware.org; auth=none
- References: <20150119171608 dot GM3360 at redhat dot com> <20150120120015 dot GU3360 at redhat dot com> <54C0287C dot 5020502 at gmail dot com>
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} };
}