fork download
  1. #include <vector>
  2.  
  3. template <class T, class F>
  4. class Bheap
  5. {
  6. public:
  7. Bheap(int allocateSize) {}
  8. void insert(T value, F f)
  9. {
  10. f(value,value);
  11. }
  12. void getMax();
  13. private:
  14. int sizeUsed;
  15. int allocateSize;
  16. std::vector<T> myBheap;
  17. };
  18.  
  19. struct SomeStruct
  20. {
  21. void operator()(int){}
  22. };
  23.  
  24. int main()
  25. {
  26. Bheap<int, SomeStruct> b(10);
  27. SomeStruct s;
  28. b.insert(10, s);
  29. }
  30.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In instantiation of 'void Bheap<T, F>::insert(T, F) [with T = int; F = SomeStruct]':
prog.cpp:28:20:   required from here
prog.cpp:10:23: error: no match for call to '(SomeStruct) (int&, int&)'
          f(value,value);
                       ^
prog.cpp:19:12: note: candidate is:
     struct SomeStruct
            ^
prog.cpp:21:11: note: void SomeStruct::operator()(int)
      void operator()(int){}
           ^
prog.cpp:21:11: note:   candidate expects 1 argument, 2 provided
stdout
Standard output is empty