mercredi 23 mai 2018

std::string list initializer {} vs

I am trying to understand how list initializers work in following code:

int main() {

  std::string t1 = ;
  std::string t2 = {};

  printf("%u ___ %u", "" == t1, "" == t2 );

  while (true);
  return 0;
}

output:

0 ___ 1

Can anyone explain what the difference between {} and is for this?

Thanks.

Aucun commentaire:

Enregistrer un commentaire