]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.pass.cpp
Import libc++ 3.7.0 release (r246257).
[FreeBSD/FreeBSD.git] / test / std / depr / depr.function.objects / depr.adaptors / depr.member.pointer.adaptors / mem_fun1_ref_t.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
12 // mem_fun1_ref_t
13
14 #include <functional>
15 #include <type_traits>
16 #include <cassert>
17
18 struct A
19 {
20     char a1() {return 5;}
21     short a2(int i) {return short(i+1);}
22     int a3() const {return 1;}
23     double a4(unsigned i) const {return i-1;}
24 };
25
26 int main()
27 {
28     typedef std::mem_fun1_ref_t<short, A, int> F;
29     static_assert((std::is_base_of<std::binary_function<A, int, short>, F>::value), "");
30     const F f(&A::a2);
31     A a;
32     assert(f(a, 5) == 6);
33 }