ptr_fun1.pass.cpp 671 B

12345678910111213141516171819202122232425
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is dual licensed under the MIT and the University of Illinois Open
  6. // Source Licenses. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // <functional>
  10. // template <CopyConstructible Arg, Returnable Result>
  11. // pointer_to_unary_function<Arg, Result>
  12. // ptr_fun(Result (*f)(Arg));
  13. #include <functional>
  14. #include <type_traits>
  15. #include <cassert>
  16. double unary_f(int i) {return 0.5 - i;}
  17. int main()
  18. {
  19. assert(std::ptr_fun(unary_f)(36) == -35.5);
  20. }