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 
10 // <functional>
11 
12 // pointer_to_binary_function
13 
14 #include <functional>
15 #include <type_traits>
16 #include <cassert>
17 
binary_f(int i,short j)18 double binary_f(int i, short j) {return i - j + .75;}
19 
main()20 int main()
21 {
22     typedef std::pointer_to_binary_function<int, short, double> F;
23     static_assert((std::is_base_of<std::binary_function<int, short, double>, F>::value), "");
24     const F f(binary_f);
25     assert(f(36, 27) == 9.75);
26 }
27