Browse Source

change(vector): emplace_back should return a ref

greatbridf 6 months ago
parent
commit
f952057453
1 changed files with 2 additions and 2 deletions
  1. 2 2
      gblibstdc++/include/vector

+ 2 - 2
gblibstdc++/include/vector

@@ -440,8 +440,8 @@ public:
     constexpr void push_back(T&& val) { insert(cend(), std::move(val)); }
 
     template <typename... Args>
-    constexpr void emplace_back(Args&&... args)
-    { emplace(cend(), std::forward<Args>(args)...); }
+    constexpr reference emplace_back(Args&&... args)
+    { return *emplace(cend(), std::forward<Args>(args)...); }
 
     constexpr void pop_back() { erase(--cend()); }