binders.cpp 812 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Simple test file for cxxomfort
  3. *
  4. * This and other examples assume cxxomfort is installed in
  5. * include library path; if otherwise, compile with
  6. * -I /path/to/cxxomfort .
  7. */
  8. #define CXXOMFORT_NOTICES 1
  9. #include <cxxomfort/backports.hpp>
  10. #include <cxxomfort/library/functional.hpp>
  11. #include <cxxomfort/library/type_name.hpp>
  12. #include <iostream>
  13. #include <cmath>
  14. #include <cstdlib>
  15. #include <ctime>
  16. int f(int) { return 1; }
  17. int f(std::tm) { return 2; }
  18. int main () {
  19. using namespace std;
  20. namespace cxl= cxxomfort::library;
  21. cxxomfort::output_info();
  22. cout<< cxl::typeid_demangle( typeid(
  23. ptr_fun(labs)
  24. ))<< endl;
  25. tm t;
  26. cxl::functional::functiontype<int(struct tm)>::pointer F = f; // should pick f(double)
  27. cout<< "expect: 2. get: "<< F(t)<< endl;
  28. }