Talk:cpp/container/vector/emplace back
From cppreference.com
The complexity for this function is stated as Constant. Is this true? Wouldn't this be amortized constant for the possibility of the vector resizing if its capacity equals its size? Drali (talk) 07:04, 20 May 2016 (PDT)
- right, of course, it is the same as push_back. Thanks for reporting! --Cubbi (talk) 07:24, 20 May 2016 (PDT)
Is this function thread safe? (is this page the approapriate location to say if this function is thread safe?) Thanks, WurmD (talk) 07:12, 22 October 2019 (PDT)
- Thread safety is discussed in detail one level up: cpp/container#Thread_safety --Cubbi (talk) 09:10, 22 October 2019 (PDT)
[edit] typo in example
It seems to me there is a small typo in the assert statement in line 30 in function main() compared to line 29.
assert(ref.year != 1984 && "uses a reference to the created object (C++17)");
->
assert(ref.year != 1994 && "uses a reference to the created object (C++17)");
(untested)
--Hexcoder (talk) 04:54, 9 August 2021 (PDT)
[edit] typo in example
reElections.push_back(President("Franklin Delano Roosevelt", "the USA", 1936));
QuentinUK (talk) 04:39, 27 July 2022 (PDT)
- You may fix it yourself here.) --Space Mission (talk) 15:01, 27 July 2022 (PDT)