forked from OSchip/llvm-project
Implement http://wg21.link/p0302r1: Removing Allocator Support in std::function. These functions never worked, and as far as I know, no one ever called them.
llvm-svn: 284164
This commit is contained in:
parent
f80c1875a3
commit
6ecac73019
libcxx
include
test/std/utilities/function.objects/func.wrap/func.wrap.func
www
|
@ -393,15 +393,15 @@ public:
|
||||||
template<class F>
|
template<class F>
|
||||||
function(F);
|
function(F);
|
||||||
template<Allocator Alloc>
|
template<Allocator Alloc>
|
||||||
function(allocator_arg_t, const Alloc&) noexcept;
|
function(allocator_arg_t, const Alloc&) noexcept; // removed in C++17
|
||||||
template<Allocator Alloc>
|
template<Allocator Alloc>
|
||||||
function(allocator_arg_t, const Alloc&, nullptr_t) noexcept;
|
function(allocator_arg_t, const Alloc&, nullptr_t) noexcept; // removed in C++17
|
||||||
template<Allocator Alloc>
|
template<Allocator Alloc>
|
||||||
function(allocator_arg_t, const Alloc&, const function&);
|
function(allocator_arg_t, const Alloc&, const function&); // removed in C++17
|
||||||
template<Allocator Alloc>
|
template<Allocator Alloc>
|
||||||
function(allocator_arg_t, const Alloc&, function&&);
|
function(allocator_arg_t, const Alloc&, function&&); // removed in C++17
|
||||||
template<class F, Allocator Alloc>
|
template<class F, Allocator Alloc>
|
||||||
function(allocator_arg_t, const Alloc&, F);
|
function(allocator_arg_t, const Alloc&, F); // removed in C++17
|
||||||
|
|
||||||
function& operator=(const function&);
|
function& operator=(const function&);
|
||||||
function& operator=(function&&) noexcept;
|
function& operator=(function&&) noexcept;
|
||||||
|
@ -1617,6 +1617,7 @@ public:
|
||||||
>::type>
|
>::type>
|
||||||
function(_Fp);
|
function(_Fp);
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER <= 14
|
||||||
template<class _Alloc>
|
template<class _Alloc>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
function(allocator_arg_t, const _Alloc&) _NOEXCEPT : __f_(0) {}
|
function(allocator_arg_t, const _Alloc&) _NOEXCEPT : __f_(0) {}
|
||||||
|
@ -1629,6 +1630,7 @@ public:
|
||||||
function(allocator_arg_t, const _Alloc&, function&&);
|
function(allocator_arg_t, const _Alloc&, function&&);
|
||||||
template<class _Fp, class _Alloc, class = typename enable_if<__callable<_Fp>::value>::type>
|
template<class _Fp, class _Alloc, class = typename enable_if<__callable<_Fp>::value>::type>
|
||||||
function(allocator_arg_t, const _Alloc& __a, _Fp __f);
|
function(allocator_arg_t, const _Alloc& __a, _Fp __f);
|
||||||
|
#endif
|
||||||
|
|
||||||
function& operator=(const function&);
|
function& operator=(const function&);
|
||||||
function& operator=(function&&) _NOEXCEPT;
|
function& operator=(function&&) _NOEXCEPT;
|
||||||
|
@ -1689,6 +1691,7 @@ function<_Rp(_ArgTypes...)>::function(const function& __f)
|
||||||
__f_ = __f.__f_->__clone();
|
__f_ = __f.__f_->__clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER <= 14
|
||||||
template<class _Rp, class ..._ArgTypes>
|
template<class _Rp, class ..._ArgTypes>
|
||||||
template <class _Alloc>
|
template <class _Alloc>
|
||||||
function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
|
function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
|
||||||
|
@ -1704,6 +1707,7 @@ function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
|
||||||
else
|
else
|
||||||
__f_ = __f.__f_->__clone();
|
__f_ = __f.__f_->__clone();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
template<class _Rp, class ..._ArgTypes>
|
template<class _Rp, class ..._ArgTypes>
|
||||||
function<_Rp(_ArgTypes...)>::function(function&& __f) _NOEXCEPT
|
function<_Rp(_ArgTypes...)>::function(function&& __f) _NOEXCEPT
|
||||||
|
@ -1722,6 +1726,7 @@ function<_Rp(_ArgTypes...)>::function(function&& __f) _NOEXCEPT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER <= 14
|
||||||
template<class _Rp, class ..._ArgTypes>
|
template<class _Rp, class ..._ArgTypes>
|
||||||
template <class _Alloc>
|
template <class _Alloc>
|
||||||
function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
|
function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
|
||||||
|
@ -1740,6 +1745,7 @@ function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
|
||||||
__f.__f_ = 0;
|
__f.__f_ = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
template<class _Rp, class ..._ArgTypes>
|
template<class _Rp, class ..._ArgTypes>
|
||||||
template <class _Fp, class>
|
template <class _Fp, class>
|
||||||
|
@ -1765,6 +1771,7 @@ function<_Rp(_ArgTypes...)>::function(_Fp __f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER <= 14
|
||||||
template<class _Rp, class ..._ArgTypes>
|
template<class _Rp, class ..._ArgTypes>
|
||||||
template <class _Fp, class _Alloc, class>
|
template <class _Fp, class _Alloc, class>
|
||||||
function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f)
|
function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f)
|
||||||
|
@ -1790,6 +1797,7 @@ function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _Fp _
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
template<class _Rp, class ..._ArgTypes>
|
template<class _Rp, class ..._ArgTypes>
|
||||||
function<_Rp(_ArgTypes...)>&
|
function<_Rp(_ArgTypes...)>&
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
// UNSUPPORTED: c++98, c++03
|
||||||
|
// XFAIL: c++11, c++14
|
||||||
|
|
||||||
|
// <functional>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
|
struct S : public std::function<void()> { using function::function; };
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
S f1( [](){} );
|
||||||
|
S f2(std::allocator_arg, std::allocator<int>{}, f1);
|
||||||
|
}
|
|
@ -8,6 +8,7 @@
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
// UNSUPPORTED: c++98, c++03
|
// UNSUPPORTED: c++98, c++03
|
||||||
|
// REQUIRES-ANY: c++11, c++14
|
||||||
|
|
||||||
// <functional>
|
// <functional>
|
||||||
|
|
||||||
|
@ -16,6 +17,8 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
using Fn = std::function<void()>;
|
using Fn = std::function<void()>;
|
||||||
struct S : public std::function<void()> { using function::function; };
|
struct S : public std::function<void()> { using function::function; };
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// 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>
|
||||||
|
// XFAIL: c++98, c++03, c++11, c++14
|
||||||
|
|
||||||
|
// class function<R(ArgTypes...)>
|
||||||
|
|
||||||
|
// template<class A> function(allocator_arg_t, const A&);
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "min_allocator.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
std::function<int(int)> f(std::allocator_arg, std::allocator<int>());
|
||||||
|
}
|
|
@ -8,10 +8,13 @@
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
// <functional>
|
// <functional>
|
||||||
|
// REQUIRES-ANY: c++98, c++03, c++11, c++14
|
||||||
|
|
||||||
// class function<R(ArgTypes...)>
|
// class function<R(ArgTypes...)>
|
||||||
|
|
||||||
// template<class A> function(allocator_arg_t, const A&);
|
// template<class A> function(allocator_arg_t, const A&);
|
||||||
|
//
|
||||||
|
// This signature was removed in C++17
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// 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>
|
||||||
|
// XFAIL: c++98, c++03, c++11, c++14
|
||||||
|
|
||||||
|
// class function<R(ArgTypes...)>
|
||||||
|
|
||||||
|
// template<class F, class A> function(allocator_arg_t, const A&, F);
|
||||||
|
//
|
||||||
|
// This signature was removed in C++17
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
|
void foo(int) {}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
std::function<void(int)> f(std::allocator_arg, std::allocator<int>(), foo);
|
||||||
|
}
|
|
@ -8,6 +8,7 @@
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
// <functional>
|
// <functional>
|
||||||
|
// REQUIRES-ANY: c++98, c++03, c++11, c++14
|
||||||
|
|
||||||
// class function<R(ArgTypes...)>
|
// class function<R(ArgTypes...)>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// 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>
|
||||||
|
// XFAIL: c++98, c++03, c++11, c++14
|
||||||
|
|
||||||
|
// class function<R(ArgTypes...)>
|
||||||
|
|
||||||
|
// template<class A> function(allocator_arg_t, const A&, const function&);
|
||||||
|
//
|
||||||
|
// This signature was removed in C++17
|
||||||
|
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
typedef std::function<void(int)> F;
|
||||||
|
F f1;
|
||||||
|
F f2(std::allocator_arg, std::allocator<int>(), f1);
|
||||||
|
}
|
|
@ -8,6 +8,7 @@
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
// <functional>
|
// <functional>
|
||||||
|
// REQUIRES-ANY: c++98, c++03, c++11, c++14
|
||||||
|
|
||||||
// class function<R(ArgTypes...)>
|
// class function<R(ArgTypes...)>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// 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>
|
||||||
|
// XFAIL: c++98, c++03, c++11, c++14
|
||||||
|
|
||||||
|
// class function<R(ArgTypes...)>
|
||||||
|
|
||||||
|
// template<class A> function(allocator_arg_t, const A&, nullptr_t);
|
||||||
|
//
|
||||||
|
// This signature was removed in C++17
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "min_allocator.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
std::function<int(int)> f(std::allocator_arg, std::allocator<int>(), nullptr);
|
||||||
|
}
|
|
@ -8,10 +8,13 @@
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
// <functional>
|
// <functional>
|
||||||
|
// REQUIRES-ANY: c++98, c++03, c++11, c++14
|
||||||
|
|
||||||
// class function<R(ArgTypes...)>
|
// class function<R(ArgTypes...)>
|
||||||
|
|
||||||
// template<class A> function(allocator_arg_t, const A&, nullptr_t);
|
// template<class A> function(allocator_arg_t, const A&, nullptr_t);
|
||||||
|
//
|
||||||
|
// This signature was removed in C++17
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// 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>
|
||||||
|
// XFAIL: c++98, c++03, c++11, c++14
|
||||||
|
|
||||||
|
// class function<R(ArgTypes...)>
|
||||||
|
|
||||||
|
// template<class A> function(allocator_arg_t, const A&, function&&);
|
||||||
|
//
|
||||||
|
// This signature was removed in C++17
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <memory>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
|
class A
|
||||||
|
{
|
||||||
|
int data_[10];
|
||||||
|
public:
|
||||||
|
static int count;
|
||||||
|
|
||||||
|
A()
|
||||||
|
{
|
||||||
|
++count;
|
||||||
|
for (int i = 0; i < 10; ++i)
|
||||||
|
data_[i] = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
A(const A&) {++count;}
|
||||||
|
|
||||||
|
~A() {--count;}
|
||||||
|
|
||||||
|
int operator()(int i) const
|
||||||
|
{
|
||||||
|
for (int j = 0; j < 10; ++j)
|
||||||
|
i += data_[j];
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
int A::count = 0;
|
||||||
|
|
||||||
|
int g(int) { return 0; }
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
std::function<int(int)> f = A();
|
||||||
|
std::function<int(int)> f2(std::allocator_arg, std::allocator<A>(), std::move(f));
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,12 +8,15 @@
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
// UNSUPPORTED: c++98, c++03
|
// UNSUPPORTED: c++98, c++03
|
||||||
|
// REQUIRES-ANY: c++11, c++14
|
||||||
|
|
||||||
// <functional>
|
// <functional>
|
||||||
|
|
||||||
// class function<R(ArgTypes...)>
|
// class function<R(ArgTypes...)>
|
||||||
|
|
||||||
// template<class A> function(allocator_arg_t, const A&, function&&);
|
// template<class A> function(allocator_arg_t, const A&, function&&);
|
||||||
|
//
|
||||||
|
// This signature was removed in C++17
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
|
@ -111,7 +111,7 @@
|
||||||
<tr><td><a href="http://wg21.link/p0254r2">p0254r2</a></td><td>LWG</td><td>Integrating std::string_view and std::string</td><td>Oulu</td><td>Complete</td><td>4.0</td></tr>
|
<tr><td><a href="http://wg21.link/p0254r2">p0254r2</a></td><td>LWG</td><td>Integrating std::string_view and std::string</td><td>Oulu</td><td>Complete</td><td>4.0</td></tr>
|
||||||
<tr><td><a href="http://wg21.link/p0258r2">p0258r2</a></td><td>LWG</td><td>has_unique_object_representations</td><td>Oulu</td><td></td><td></td></tr>
|
<tr><td><a href="http://wg21.link/p0258r2">p0258r2</a></td><td>LWG</td><td>has_unique_object_representations</td><td>Oulu</td><td></td><td></td></tr>
|
||||||
<tr><td><a href="http://wg21.link/p0295r0">p0295r0</a></td><td>LWG</td><td>Adopt Selected Library Fundamentals V2 Components for C++17</td><td>Oulu</td><td>Complete</td><td>4.0</td></tr>
|
<tr><td><a href="http://wg21.link/p0295r0">p0295r0</a></td><td>LWG</td><td>Adopt Selected Library Fundamentals V2 Components for C++17</td><td>Oulu</td><td>Complete</td><td>4.0</td></tr>
|
||||||
<tr><td><a href="http://wg21.link/p0302r1">p0302r1</a></td><td>LWG</td><td>Removing Allocator Support in std::function</td><td>Oulu</td><td></td><td></td></tr>
|
<tr><td><a href="http://wg21.link/p0302r1">p0302r1</a></td><td>LWG</td><td>Removing Allocator Support in std::function</td><td>Oulu</td><td>Complete</td><td>4.0</td></tr>
|
||||||
<tr><td><a href="http://wg21.link/p0307r2">p0307r2</a></td><td>LWG</td><td>Making Optional Greater Equal Again</td><td>Oulu</td><td></td><td></td></tr>
|
<tr><td><a href="http://wg21.link/p0307r2">p0307r2</a></td><td>LWG</td><td>Making Optional Greater Equal Again</td><td>Oulu</td><td></td><td></td></tr>
|
||||||
<tr><td><a href="http://wg21.link/p0336r1">p0336r1</a></td><td>LWG</td><td>Better Names for Parallel Execution Policies in C++17</td><td>Oulu</td><td></td><td></td></tr>
|
<tr><td><a href="http://wg21.link/p0336r1">p0336r1</a></td><td>LWG</td><td>Better Names for Parallel Execution Policies in C++17</td><td>Oulu</td><td></td><td></td></tr>
|
||||||
<tr><td><a href="http://wg21.link/p0337r0">p0337r0</a></td><td>LWG</td><td>Delete operator= for polymorphic_allocator</td><td>Oulu</td><td>Complete</td><td>3.9</td></tr>
|
<tr><td><a href="http://wg21.link/p0337r0">p0337r0</a></td><td>LWG</td><td>Delete operator= for polymorphic_allocator</td><td>Oulu</td><td>Complete</td><td>3.9</td></tr>
|
||||||
|
@ -317,7 +317,7 @@
|
||||||
<!-- <tr><td></td><td></td><td></td><td></td></tr> -->
|
<!-- <tr><td></td><td></td><td></td><td></td></tr> -->
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<p>Last Updated: 12-Jul-2016</p>
|
<p>Last Updated: 13-Oct-2016</p>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue