Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
考虑这个片段:
#include <vector> struct A { A(int b): m_b(b) { } private: int m_b; }; int main() { std::vector<A> vec; vec.push_back( A(3) ); vec.emplace_back( 3 ); }
在传递临时值的特定情况下,编译器不会优化的两个调用之间是否有任何区别?我应该更喜欢其中一个吗?