fork(1) download
  1. #include <algorithm>
  2. #include <iterator>
  3. #include <iostream>
  4. #include <iomanip>
  5. #include <utility>
  6. #include <string>
  7. #include <vector>
  8. #include <memory>
  9. #include <limits>
  10. #include <queue>
  11. #include <cmath>
  12. #include <map>
  13. #include <set>
  14.  
  15. using namespace std;
  16.  
  17. typedef long long ll;
  18.  
  19. struct document
  20. {
  21. float rank;
  22. document(float rank):
  23. rank(rank)
  24. { }
  25. };
  26.  
  27. using doc_ptr = shared_ptr<document>;
  28.  
  29. bool operator < (const doc_ptr& x, const doc_ptr& y)
  30. {
  31. return x->rank < y->rank;
  32. }
  33.  
  34. int main()
  35. {
  36. const doc_ptr x = make_shared<document>(1.);
  37. const doc_ptr y = make_shared<document>(0.);
  38.  
  39. cout << "ptrs: " << (x.get() < y.get()) << endl;
  40. cout << "values: " << (x->rank< y->rank) << endl;
  41. cout << "operator <: " << (x < y) << endl;
  42. cout << "less: " << less<doc_ptr>()(x, y) << endl;
  43.  
  44. return 0;
  45. }
  46.  
Success #stdin #stdout 0s 4496KB
stdin
Standard input is empty
stdout
ptrs: 1
values: 0
operator <: 0
less: 1