Guest User

Untitled

a guest
Jan 18th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. class A
  2. {
  3. public:
  4. char * name;
  5. };
  6.  
  7. template < class Key, class Compare = less<Key>,
  8. class Allocator = allocator<Key> > class set;
  9.  
  10. template<typename _Key, typename _Val, typename _KeyOfValue,
  11. typename _Compare, typename _Alloc>
  12. typename _Rb_tree<_Key, _Val, _KeyOfValue,
  13. _Compare, _Alloc>::iterator
  14. _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
  15. find(const _Key& __k)
  16. {
  17. iterator __j = _M_lower_bound(_M_begin(), _M_end(), __k);
  18. return (__j == end()
  19. || _M_impl._M_key_compare(__k, _S_key(__j._M_node))) ? end() : __j;
  20. }
  21.  
  22. struct comparator : std::binary_function<A,A,bool> {
  23. bool operator()( A const& lhs, A const& rhs ) const;
  24. };
  25.  
  26. a == b <==> !(a < b) && !(b < a)
  27.  
  28. set<Item*> itemSet;
  29.  
  30. Item* item = new Item();
  31.  
  32. if (itemSet.count(item) == 0)
  33. {
  34. std::cout<<"not found"
  35. }
  36. //or
  37. if (itemSet.find(item) == itemSet.end())
  38. {
  39. std::cout<<"not found"
  40. }
Add Comment
Please, Sign In to add comment