aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorVille Voutilainen <ville.voutilainen@gmail.com>2016-06-06 19:28:59 +0300
committerVille Voutilainen <ville@gcc.gnu.org>2016-06-06 19:28:59 +0300
commitdbc6221fe5aa38017bb5818aa28257360b15f3b6 (patch)
tree71c188a4452b7f4784584d882f6fd4725511f290 /libstdc++-v3
parent36f9ad69336aeee0aa7cf2d8640fccbec8d659e1 (diff)
downloadgcc-dbc6221fe5aa38017bb5818aa28257360b15f3b6.zip
gcc-dbc6221fe5aa38017bb5818aa28257360b15f3b6.tar.gz
gcc-dbc6221fe5aa38017bb5818aa28257360b15f3b6.tar.bz2
Support allocators in tuples of zero size.
* include/std/tuple (tuple<>::tuple(), tuple<>::tuple(allocator_arg_t, const _Alloc&), tuple<>::tuple(allocator_arg_t, const _Alloc&, const tuple&)): New. * testsuite/20_util/tuple/cons/allocators.cc: Adjust. From-SVN: r237143
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog8
-rw-r--r--libstdc++-v3/include/std/tuple8
-rw-r--r--libstdc++-v3/testsuite/20_util/tuple/cons/allocators.cc22
3 files changed, 38 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index b938ea2..f550c35 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,11 @@
+2016-06-06 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ Support allocators in tuples of zero size.
+ * include/std/tuple (tuple<>::tuple(),
+ tuple<>::tuple(allocator_arg_t, const _Alloc&),
+ tuple<>::tuple(allocator_arg_t, const _Alloc&, const tuple&)): New.
+ * testsuite/20_util/tuple/cons/allocators.cc: Adjust.
+
2016-06-06 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/71320
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index 17c8204..e64f6bf 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -876,6 +876,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
public:
void swap(tuple&) noexcept { /* no-op */ }
+ // We need the default since we're going to define no-op
+ // allocator constructors.
+ tuple() = default;
+ // No-op allocator constructors.
+ template<typename _Alloc>
+ tuple(allocator_arg_t, const _Alloc&) { }
+ template<typename _Alloc>
+ tuple(allocator_arg_t, const _Alloc&, const tuple&) { }
};
/// Partial specialization, 2-element tuple.
diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/allocators.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/allocators.cc
index 052b79f..bc45780 100644
--- a/libstdc++-v3/testsuite/20_util/tuple/cons/allocators.cc
+++ b/libstdc++-v3/testsuite/20_util/tuple/cons/allocators.cc
@@ -162,8 +162,30 @@ void test01()
}
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ using std::allocator_arg;
+ using std::tuple;
+ using std::make_tuple;
+
+ typedef tuple<> test_type;
+
+ MyAlloc a;
+
+ // default construction
+ test_type t1(allocator_arg, a);
+ // copy construction
+ test_type t2(allocator_arg, a, t1);
+ // move construction
+ test_type t3(allocator_arg, a, std::move(t1));
+ // make_tuple
+ test_type empty = make_tuple();
+}
+
int main()
{
test01();
+ test02();
return 0;
}