fork download
  1. #include <map>
  2. #include <functional>
  3.  
  4. template <typename T>
  5. static bool indirectLess(const T* a, const T* b)
  6. {
  7. if (a==b)
  8. return false;
  9. if (!a)
  10. return true;
  11. if (!b)
  12. return false;
  13. return std::less<T>()(*a, *b);
  14. }
  15.  
  16. typedef int T;
  17. typedef int V;
  18.  
  19. int main()
  20. {
  21. typedef bool (*cmp_t)(const T*, const T*);
  22.  
  23. std::map<T*,V,cmp_t> tsMap(&indirectLess<T>);
  24. }
  25.  
  26.  
Success #stdin #stdout 0s 2720KB
stdin
Standard input is empty
stdout
Standard output is empty