Please tell me which method would be better in this case, I want to use std::find later for the vectors. Vectors will include all times a tiny dataset. Thank you.
int main()
{
// method1
std::vector<int> v1 = {1,2,3,4,5};
bool cond;
if (cond)
{
// find something in v1
}
else
{
v1 = {1,2,3};
// find something in v1 with new values
}
// method2
std::vector<int> v1 = {1,2,3,4,5};
bool cond;
if (cond)
{
// find something in v1
}
else
{
std::vector<int> v2 = {1,2,3};
// find something in v2
}
return 0;
}
Aucun commentaire:
Enregistrer un commentaire