summaryrefslogtreecommitdiff
path: root/test/std/containers/sequences/vector.bool/emplace.pass.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-09-06 18:46:46 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-09-06 18:46:46 +0000
commit61b9a7258a7693d7f3674a5a1daf7b036ff1d382 (patch)
treeec41ed70ffca97240e76f9a78bb2dedba28f310c /test/std/containers/sequences/vector.bool/emplace.pass.cpp
parentf857581820d15e410e9945d2fcd5f7163be25a96 (diff)
Notes
Diffstat (limited to 'test/std/containers/sequences/vector.bool/emplace.pass.cpp')
-rw-r--r--test/std/containers/sequences/vector.bool/emplace.pass.cpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/test/std/containers/sequences/vector.bool/emplace.pass.cpp b/test/std/containers/sequences/vector.bool/emplace.pass.cpp
new file mode 100644
index 0000000000000..f3fd1e9926f03
--- /dev/null
+++ b/test/std/containers/sequences/vector.bool/emplace.pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+// vector<bool>
+
+// template <class... Args> iterator emplace(const_iterator pos, Args&&... args);
+
+#include <vector>
+#include <cassert>
+#include "min_allocator.h"
+
+int main()
+{
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::vector<bool> C;
+ C c;
+
+ C::iterator i = c.emplace(c.cbegin());
+ assert(i == c.begin());
+ assert(c.size() == 1);
+ assert(c.front() == false);
+
+ i = c.emplace(c.cend(), true);
+ assert(i == c.end()-1);
+ assert(c.size() == 2);
+ assert(c.front() == false);
+ assert(c.back() == true);
+
+ i = c.emplace(c.cbegin()+1, 1 == 1);
+ assert(i == c.begin()+1);
+ assert(c.size() == 3);
+ assert(c.front() == false);
+ assert(c[1] == true);
+ assert(c.back() == true);
+ }
+ {
+ typedef std::vector<bool, min_allocator<bool>> C;
+ C c;
+
+ C::iterator i = c.emplace(c.cbegin());
+ assert(i == c.begin());
+ assert(c.size() == 1);
+ assert(c.front() == false);
+
+ i = c.emplace(c.cend(), true);
+ assert(i == c.end()-1);
+ assert(c.size() == 2);
+ assert(c.front() == false);
+ assert(c.back() == true);
+
+ i = c.emplace(c.cbegin()+1, 1 == 1);
+ assert(i == c.begin()+1);
+ assert(c.size() == 3);
+ assert(c.size() == 3);
+ assert(c.front() == false);
+ assert(c[1] == true);
+ assert(c.back() == true);
+ }
+#endif
+}