Vector emplace back struct in C++

The point of using emplace_back is to avoid creating a temporary object, which is then copied (or moved) to the destination. While it is also possible to create a temporary object, then pass that to emplace_back, it defeats (at least most of) the purpose. What you want to do is pass individual arguments, then let emplace_back invoke the ctor with those arguments to create the object in place. From [1]

The code is for a two pointer problem

Reference

[1] https://stackoverflow.com/questions/13812703/c11-emplace-back-on-vectorstruct

`

Data Scientist/MLE/SWE @takemobi