dimanche 31 décembre 2017

Correct use of reference pointers and initializer_list

What's the difference between having (as a parameter of a function ofc) an initializer_list const &some_value and then giving that value to something like a vector and initializer_list const some_value and doing the same? I'm trying to learn C++ all over again, but the concept of initialization lists and reference pointers are making it hard (I come from C).

I'm just confused, both can compile just fine... is the first one taking the address of the initializer list and passing the value of that address to the vector and the second one is just copying the values of the list? which one should I use in a situation like this (if I wanted to make a constructor function for a class that has vectors in it).

Aucun commentaire:

Enregistrer un commentaire