fork download
  1. #include <functional>
  2. using namespace std;
  3.  
  4. std::function<int (float)> discretize = [](float x)->int {return 0;};
  5.  
  6. template <typename DS>
  7. auto discretizeAny(DS& ds) {
  8. return ds.map(discretize);
  9. }
  10.  
  11. template <typename T>
  12. class MyDS {};
  13.  
  14. template <>
  15. class MyDS<float> {
  16. public:
  17. MyDS<int> map(std::function<int (float)>) {
  18. return MyDS<int>();
  19. }
  20. };
  21.  
  22. int main() {
  23. MyDS<float> ds;
  24. MyDS<int> ds1 = discretizeAny(ds);
  25. return 0;
  26. }
Success #stdin #stdout 0s 3424KB
stdin
Standard input is empty
stdout
Standard output is empty