Cleanup <__functional_03>
<__functional_03> provides the C++03 definitions for std::memfun and std::function. However the interaction between <functional> and <__functional_03> is ugly and duplicates code needlessly. This patch cleans up how the two headers work together. The major changes are: - Provide placeholders, is_bind_expression and is_placeholder in <functional> for both C++03 and C++11. - Provide bad_function_call, function fwd decl, __maybe_derive_from_unary_function and __maybe_derive_from_binary_function in <functional> for both C++03 and C++11. - Move the <__functional_03> include to the bottom of <functional>. This makes it easier to see how <__functional_03> interacts with <functional> - Remove a commented out implementation of bind in C++03. It's never going to get implemented. - Mark almost all std::bind tests as unsupported in C++03. std::is_placeholder works in C++03 and C++11. std::is_bind_expression is provided in C++03 but always returns false. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@242870 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <functional>
|
||||
|
||||
// template<CopyConstructible Fn, CopyConstructible... Types>
|
||||
|
@@ -7,6 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <functional>
|
||||
|
||||
// template<CopyConstructible Fn, CopyConstructible... Types>
|
||||
|
@@ -7,6 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <functional>
|
||||
|
||||
// template<CopyConstructible Fn, CopyConstructible... Types>
|
||||
|
@@ -7,6 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <functional>
|
||||
|
||||
// template<CopyConstructible Fn, CopyConstructible... Types>
|
||||
|
@@ -7,6 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <functional>
|
||||
|
||||
// template<CopyConstructible Fn, CopyConstructible... Types>
|
||||
|
@@ -7,6 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <functional>
|
||||
|
||||
// template<CopyConstructible Fn, CopyConstructible... Types>
|
||||
|
@@ -7,6 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <functional>
|
||||
|
||||
// template<CopyConstructible Fn, CopyConstructible... Types>
|
||||
|
@@ -7,6 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <functional>
|
||||
|
||||
// template<class T> struct is_bind_expression
|
||||
|
@@ -0,0 +1,39 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// TESTING template<class T> struct is_bind_expression
|
||||
//
|
||||
// bind is not implemented in C++03 so nothing is a bind expression. However
|
||||
// for compatibility reasons the trait is_bind_expression should be available
|
||||
// in C++03 and it should always return false.
|
||||
|
||||
#include <functional>
|
||||
|
||||
template <class T>
|
||||
void test() {
|
||||
static_assert(!std::is_bind_expression<T>::value, "");
|
||||
}
|
||||
|
||||
struct C {};
|
||||
|
||||
int main() {
|
||||
test<int>();
|
||||
test<void>();
|
||||
test<C>();
|
||||
test<C&>();
|
||||
test<C const&>();
|
||||
test<C*>();
|
||||
test<void()>();
|
||||
test<int(*)()>();
|
||||
test<int (C::*)()>();
|
||||
test<decltype(std::placeholders::_2)>();
|
||||
}
|
Reference in New Issue
Block a user