pointer_to_binary_function.pass.cpp 742 B

1234567891011121314151617181920212223242526
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // <functional>
  10. // pointer_to_binary_function
  11. #include <functional>
  12. #include <type_traits>
  13. #include <cassert>
  14. double binary_f(int i, short j) {return i - j + .75;}
  15. int main()
  16. {
  17. typedef std::pointer_to_binary_function<int, short, double> F;
  18. static_assert((std::is_base_of<std::binary_function<int, short, double>, F>::value), "");
  19. const F f(binary_f);
  20. assert(f(36, 27) == 9.75);
  21. }