Implement LWG Issue #2187 (emplace_back and emplace for vector<bool>)

llvm-svn: 188333
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 2d6e2834a8abcce862ef17c44f62e4de41662748
diff --git a/include/vector b/include/vector
index df14344..0855e8b 100644
--- a/include/vector
+++ b/include/vector
@@ -216,8 +216,10 @@
     const_reference back() const;
 
     void push_back(const value_type& x);
+    template <class... Args> void emplace_back(Args&&... args);  // C++14
     void pop_back();
 
+    template <class... Args> iterator emplace(const_iterator position, Args&&... args);  // C++14
     iterator insert(const_iterator position, const value_type& x);
     iterator insert(const_iterator position, size_type n, const value_type& x);
     template <class InputIterator>
@@ -2221,8 +2223,20 @@
     _LIBCPP_INLINE_VISIBILITY const_reference back()  const {return __make_ref(__size_ - 1);}
 
     void push_back(const value_type& __x);
+#if _LIBCPP_STD_VER > 11
+    template <class... _Args>
+    _LIBCPP_INLINE_VISIBILITY void emplace_back(_Args&&... __args)
+        { push_back ( value_type ( _VSTD::forward<_Args>(__args)... )); }
+#endif
+
     _LIBCPP_INLINE_VISIBILITY void pop_back() {--__size_;}
 
+#if _LIBCPP_STD_VER > 11
+    template <class... _Args>
+   _LIBCPP_INLINE_VISIBILITY iterator emplace(const_iterator position, _Args&&... __args)
+        { return insert ( position, value_type ( _VSTD::forward<_Args>(__args)... )); }
+#endif
+
     iterator insert(const_iterator __position, const value_type& __x);
     iterator insert(const_iterator __position, size_type __n, const value_type& __x);
     iterator insert(const_iterator __position, size_type __n, const_reference __x);