• 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<Returnable S, ClassType T, CopyConstructible A>
13 //   const_mem_fun1_t<S,T,A>
14 //   mem_fun(S (T::*f)(A) const);
15 
16 #include <functional>
17 #include <cassert>
18 
19 struct A
20 {
a1A21     char a1() {return 5;}
a2A22     short a2(int i) {return short(i+1);}
a3A23     int a3() const {return 1;}
a4A24     double a4(unsigned i) const {return i-1;}
25 };
26 
main()27 int main()
28 {
29     const A a = A();
30     assert(std::mem_fun(&A::a4)(&a, 6) == 5);
31 }
32