lundi 4 mai 2020

Difference in default initialization of struct members

struct Date1 {
  int day{1};
  int month{1};
  int year{2000};
};
struct Date2 {
  int day  =1;
  int month =1;
  int year =2000;
};
struct Date3 {
  Date() : day(1), month(1), year(2000) {}
  int day;
  int month;
  int year;
};

Is there any difference in terms of efficiency between those three options of default initialization of the struct member?

Aucun commentaire:

Enregistrer un commentaire