]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.pass.cpp
Vendor import of libc++ trunk r300422:
[FreeBSD/FreeBSD.git] / test / std / depr / depr.function.objects / depr.adaptors / depr.member.pointer.adaptors / const_mem_fun1.pass.cpp
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 // REQUIRES: c++98 || c++03 || c++11 || c++14
12
13 // template<Returnable S, ClassType T, CopyConstructible A>
14 //   const_mem_fun1_t<S,T,A>
15 //   mem_fun(S (T::*f)(A) const);
16
17 #include <functional>
18 #include <cassert>
19
20 struct A
21 {
22     char a1() {return 5;}
23     short a2(int i) {return short(i+1);}
24     int a3() const {return 1;}
25     double a4(unsigned i) const {return i-1;}
26 };
27
28 int main()
29 {
30     const A a = A();
31     assert(std::mem_fun(&A::a4)(&a, 6) == 5);
32 }