cleaning up...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121275 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <functional>
|
||||
|
||||
// pointer_to_binary_function
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
||||
double binary_f(int i, short j) {return i - j + .75;}
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef std::pointer_to_binary_function<int, short, double> F;
|
||||
static_assert((std::is_base_of<std::binary_function<int, short, double>, F>::value), "");
|
||||
const F f(binary_f);
|
||||
assert(f(36, 27) == 9.75);
|
||||
}
|
@@ -1,26 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <functional>
|
||||
|
||||
// pointer_to_unary_function
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
||||
double unary_f(int i) {return 0.5 - i;}
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef std::pointer_to_unary_function<int, double> F;
|
||||
static_assert((std::is_base_of<std::unary_function<int, double>, F>::value), "");
|
||||
const F f(unary_f);
|
||||
assert(f(36) == -35.5);
|
||||
}
|
@@ -1,25 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <functional>
|
||||
|
||||
// template <CopyConstructible Arg, Returnable Result>
|
||||
// pointer_to_unary_function<Arg, Result>
|
||||
// ptr_fun(Result (*f)(Arg));
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
||||
double unary_f(int i) {return 0.5 - i;}
|
||||
|
||||
int main()
|
||||
{
|
||||
assert(std::ptr_fun(unary_f)(36) == -35.5);
|
||||
}
|
@@ -1,25 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <functional>
|
||||
|
||||
// template <CopyConstructible Arg1, CopyConstructible Arg2, Returnable Result>
|
||||
// pointer_to_binary_function<Arg1,Arg2,Result>
|
||||
// ptr_fun(Result (*f)(Arg1, Arg2));
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
||||
double binary_f(int i, short j) {return i - j + .75;}
|
||||
|
||||
int main()
|
||||
{
|
||||
assert(std::ptr_fun(binary_f)(36, 27) == 9.75);
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <functional>
|
||||
|
||||
// template<cReturnable S, ClassType T>
|
||||
// const_mem_fun_t<S,T>
|
||||
// mem_fun(S (T::*f)() const);
|
||||
|
||||
#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()
|
||||
{
|
||||
const A a = A();
|
||||
assert(std::mem_fun(&A::a3)(&a) == 1);
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <functional>
|
||||
|
||||
// template<Returnable S, ClassType T, CopyConstructible A>
|
||||
// const_mem_fun1_t<S,T,A>
|
||||
// mem_fun(S (T::*f)(A) const);
|
||||
|
||||
#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()
|
||||
{
|
||||
const A a = A();
|
||||
assert(std::mem_fun(&A::a4)(&a, 6) == 5);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <functional>
|
||||
|
||||
// const_mem_fun1_ref_t
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#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()
|
||||
{
|
||||
typedef std::const_mem_fun1_ref_t<double, A, unsigned> F;
|
||||
static_assert((std::is_base_of<std::binary_function<A, unsigned, double>, F>::value), "");
|
||||
const F f(&A::a4);
|
||||
const A a = A();
|
||||
assert(f(a, 6) == 5);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <functional>
|
||||
|
||||
// const_mem_fun1_t
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#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()
|
||||
{
|
||||
typedef std::const_mem_fun1_t<double, A, unsigned> F;
|
||||
static_assert((std::is_base_of<std::binary_function<const A*, unsigned, double>, F>::value), "");
|
||||
const F f(&A::a4);
|
||||
const A a = A();
|
||||
assert(f(&a, 6) == 5);
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <functional>
|
||||
|
||||
// template<Returnable S, ClassType T>
|
||||
// const_mem_fun_ref_t<S,T>
|
||||
// mem_fun_ref(S (T::*f)() const);
|
||||
|
||||
#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()
|
||||
{
|
||||
const A a = A();
|
||||
assert(std::mem_fun_ref(&A::a3)(a) == 1);
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <functional>
|
||||
|
||||
// template<Returnable S, ClassType T, CopyConstructible A>
|
||||
// const_mem_fun1_ref_t<S,T,A>
|
||||
// mem_fun_ref(S (T::*f)(A) const);
|
||||
|
||||
#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()
|
||||
{
|
||||
const A a = A();
|
||||
assert(std::mem_fun_ref(&A::a4)(a, 6) == 5);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <functional>
|
||||
|
||||
// const_mem_fun_ref_t
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#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()
|
||||
{
|
||||
typedef std::const_mem_fun_ref_t<int, A> F;
|
||||
static_assert((std::is_base_of<std::unary_function<A, int>, F>::value), "");
|
||||
const F f(&A::a3);
|
||||
const A a = A();
|
||||
assert(f(a) == 1);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <functional>
|
||||
|
||||
// const_mem_fun_t
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#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()
|
||||
{
|
||||
typedef std::const_mem_fun_t<int, A> F;
|
||||
static_assert((std::is_base_of<std::unary_function<const A*, int>, F>::value), "");
|
||||
const F f(&A::a3);
|
||||
const A a = A();
|
||||
assert(f(&a) == 1);
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <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);
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <functional>
|
||||
|
||||
// template<Returnable S, ClassType T, CopyConstructible A>
|
||||
// mem_fun1_t<S,T,A>
|
||||
// mem_fun(S (T::*f)(A));
|
||||
|
||||
#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::a2)(&a, 5) == 6);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <functional>
|
||||
|
||||
// mem_fun1_ref_t
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#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()
|
||||
{
|
||||
typedef std::mem_fun1_ref_t<short, A, int> F;
|
||||
static_assert((std::is_base_of<std::binary_function<A, int, short>, F>::value), "");
|
||||
const F f(&A::a2);
|
||||
A a;
|
||||
assert(f(a, 5) == 6);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <functional>
|
||||
|
||||
// mem_fun1_t
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#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()
|
||||
{
|
||||
typedef std::mem_fun1_t<short, A, int> F;
|
||||
static_assert((std::is_base_of<std::binary_function<A*, int, short>, F>::value), "");
|
||||
const F f(&A::a2);
|
||||
A a;
|
||||
assert(f(&a, 5) == 6);
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <functional>
|
||||
|
||||
// template<Returnable S, ClassType T>
|
||||
// mem_fun_ref_t<S,T>
|
||||
// mem_fun_ref(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_ref(&A::a1)(a) == 5);
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <functional>
|
||||
|
||||
// template<Returnable S, ClassType T, CopyConstructible A>
|
||||
// mem_fun1_ref_t<S,T,A>
|
||||
// mem_fun_ref(S (T::*f)(A));
|
||||
|
||||
#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_ref(&A::a2)(a, 5) == 6);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <functional>
|
||||
|
||||
// mem_fun_ref_t
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#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()
|
||||
{
|
||||
typedef std::mem_fun_ref_t<char, A> F;
|
||||
static_assert((std::is_base_of<std::unary_function<A, char>, F>::value), "");
|
||||
const F f(&A::a1);
|
||||
A a;
|
||||
assert(f(a) == 5);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <functional>
|
||||
|
||||
// mem_fun_t
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#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()
|
||||
{
|
||||
typedef std::mem_fun_t<char, A> F;
|
||||
static_assert((std::is_base_of<std::unary_function<A*, char>, F>::value), "");
|
||||
const F f(&A::a1);
|
||||
A a;
|
||||
assert(f(&a) == 5);
|
||||
}
|
@@ -1,20 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <functional>
|
||||
|
||||
#include <functional>
|
||||
|
||||
#ifndef _LIBCPP_VERSION
|
||||
#error _LIBCPP_VERSION not defined
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user