I ask knowing the difference between these two implementations :
std::vector<std::unique_ptr<Character>> characters;
characters.emplace_back(new Character("Character", 100));
And
std::vector<std::unique_ptr<Character>> characters;
characters.emplace_back(std::make_unique<Character> ("Character", 100));
For Character
's type example (in case needing details) :
class Character{
public:
Character(){
m_name="";
m_life=0;
}
Character(std::string name, int life):m_name(name), m_life(life){
position= new AdaptPosition{0,0};
}
virtual~Character(){delete position;}
void advance(int const& x, int const& y){
advancex(x);
advancey(y);
}
void advancex(int x){
position->advancedx(x);
}
void advancey(int y){
position->advancedy(y);
}
void getPosition(){
position->show();
}
friend std::ostream& operator<<(std::ostream& out, Character& character){
out << character.m_name << "With life :"<< character.m_life << " In position :"<< std::endl;
character.getPosition();
return out;
}
protected:
std::string m_name;
int m_life;
AdaptPosition *position;
};
Following this example, is there any diffrence when it compiles (Assembly view), or is there different Assembly instructions between the two ways ?