summaryrefslogtreecommitdiffstats
path: root/libcxx/test/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2010-09-05 01:14:30 +0000
committerHoward Hinnant <hhinnant@apple.com>2010-09-05 01:14:30 +0000
commitcbf93f39592428fc01f0c92196c6abf35dc4ed42 (patch)
tree97d12422d41120001132cdcafc2d442ce0ab86ed /libcxx/test/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp
parentf9e81f9acbdd07281775fcf8cfcdd2b6a218da19 (diff)
downloadbcm5719-llvm-cbf93f39592428fc01f0c92196c6abf35dc4ed42.tar.gz
bcm5719-llvm-cbf93f39592428fc01f0c92196c6abf35dc4ed42.zip
sync with N3126
llvm-svn: 113101
Diffstat (limited to 'libcxx/test/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp')
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp
new file mode 100644
index 00000000000..9d7fb951916
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+// template <class T, class Container, class Compare>
+// void swap(priority_queue<T, Container, Compare>& x,
+// priority_queue<T, Container, Compare>& y);
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+ std::priority_queue<int> q1;
+ std::priority_queue<int> q2;
+ q1.push(1);
+ q1.push(3);
+ q1.push(2);
+ swap(q1, q2);
+ assert(q1.empty());
+ assert(q2.size() == 3);
+ assert(q2.top() == 3);
+}
OpenPOWER on IntegriCloud