Difference between make_pair and curly brackets { } for assigning a pair in C++?
I didn't find anyone answering this, is there any difference between the following : v.push_back({x, y}); and : v.push_back(make_pair(x, y)); Assuming that v was declared this way : vector<pair<int,int> > v; I tried this in an online compiler, and as far as I can see the optimized assembly for make_pair is identical to {} syntax. https://godbolt.org/z/P7Ugkt I think you might have accepted that answer a little too quickly. The commonly accepted way to do this is like this: vec.emplace_back (x, y); And if you look at Godbolt, you can see that this inlines everything (which may or may not be