2010-08-22 02:59:46 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2010-11-16 23:09:02 +01:00
|
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
|
|
// Source Licenses. See LICENSE.TXT for details.
|
2010-08-22 02:59:46 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// <functional>
|
|
|
|
|
|
|
|
// template<Returnable S, ClassType T>
|
|
|
|
// mem_fun_t<S,T>
|
|
|
|
// mem_fun(S (T::*f)());
|
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
#include <cassert>
|
|
|
|
|
|
|
|
struct A
|
|
|
|
{
|
|
|
|
char a1() {return 5;}
|
|
|
|
short a2(int i) {return short(i+1);}
|
|
|
|
int a3() const {return 1;}
|
|
|
|
double a4(unsigned i) const {return i-1;}
|
|
|
|
};
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
A a;
|
|
|
|
assert(std::mem_fun(&A::a1)(&a) == 5);
|
|
|
|
}
|