I noticed that in C++11 I can initialize a vector in the following ways(not only these):
std::vector<int> v1{0,1,2};
std::vector<int> v2={3,4,5};
I suppose that in the first line the following constructor is used:
vector( std::initializer_list<T> init,
const Allocator& alloc = Allocator() );
My doubt is whether the second line uses the same constructor or the operator overloading of '=' is involved.
Here http://ift.tt/1t18ulj, it says that
T object = {arg1, arg2, ...};
is considered as an initializer_list, right?
Aucun commentaire:
Enregistrer un commentaire