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
15// REQUIRES: c++03 || c++11 || c++14
16// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
17
18#include <functional>
19#include <cassert>
20
21#include "test_macros.h"
22
23struct A
24{
25 char a1() {return 5;}
26 short a2(int i) {return short(i+1);}
27 int a3() const {return 1;}
28 double a4(unsigned i) const {return i-1;}
29};
30
31int main(int, char**)
32{
33 const A a = A();
34 assert(std::mem_fun(&A::a3)(&a) == 1);
35
36 return 0;
37}
38

source code of libcxx/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.pass.cpp