1 | //===----------------------------------------------------------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | // <functional> |
10 | |
11 | // template<cReturnable S, ClassType T> |
12 | // const_mem_fun_t<S,T> |
13 | // mem_fun(S (T::*f)() const); |
14 | // Removed in c++17 |
15 | |
16 | // UNSUPPORTED: c++03, c++11, c++14 |
17 | // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS |
18 | |
19 | #include <functional> |
20 | #include <cassert> |
21 | |
22 | #include "test_macros.h" |
23 | |
24 | struct A |
25 | { |
26 | char a1() {return 5;} |
27 | short a2(int i) {return short(i+1);} |
28 | int a3() const {return 1;} |
29 | double a4(unsigned i) const {return i-1;} |
30 | }; |
31 | |
32 | int main(int, char**) |
33 | { |
34 | const A a = A(); |
35 | assert(std::mem_fun(&A::a3)(&a) == 1); |
36 | |
37 | return 0; |
38 | } |
39 | |