• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // template <CopyConstructible Arg, Returnable Result>
13 // pointer_to_unary_function<Arg, Result>
14 // ptr_fun(Result (*f)(Arg));
15 
16 #include <functional>
17 #include <type_traits>
18 #include <cassert>
19 
unary_f(int i)20 double unary_f(int i) {return 0.5 - i;}
21 
main()22 int main()
23 {
24     assert(std::ptr_fun(unary_f)(36) == -35.5);
25 }
26