This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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} };
   }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]