I know I can mix two types with std::pair
but what is the difference of
using std::pair
instead of a class I created?.
What are the advantages of each of them, and why should I use std::pair?
struct MyObject{
int a;
std::string b;
MyObject(int p_a,std::string p_b)
a:p_a , b:p_b
{
};
};
std::pair<int,std::string> DefaultPair=std::make_pair(20,"Default Pair");
//Why should I use this
MyObject MyPair(10,"My Custom Pair");
//When I can use this?