Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.97 KB | None | 0 0
  1.     _NODISCARD iterator find(const key_type& _Keyval)
  2.         {   // find an element in mutable hash table that matches _Keyval
  3.         return (lower_bound(_Keyval));
  4.         }
  5.  
  6.     _NODISCARD const_iterator find(const key_type& _Keyval) const
  7.         {   // find an element in nonmutable hash table that matches _Keyval
  8.         return (lower_bound(_Keyval));
  9.         }
  10.  
  11.     _NODISCARD size_type count(const key_type& _Keyval) const
  12.         {   // count all elements that match _Keyval
  13.         _Paircc _Ans = equal_range(_Keyval);
  14.         return (static_cast<size_type>(_STD distance(_Ans.first, _Ans.second)));
  15.         }
  16.  
  17.     _NODISCARD iterator lower_bound(const key_type& _Keyval)
  18.         {   // find leftmost not less than _Keyval in mutable hash table
  19.         size_type _Bucket = _Hashval(_Keyval);
  20.         for (_Unchecked_iterator _Where = _Begin(_Bucket);
  21.             _Where != _End(_Bucket); ++_Where)
  22.             if (!_Traitsobj(_Traits::_Kfn(*_Where), _Keyval))
  23.                 return (_Traitsobj(_Keyval,
  24.                     _Traits::_Kfn(*_Where)) ? end() : _Make_iter(_Where));
  25.         return (end());
  26.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement