Please can anybody explain to me what this means?
vector<int> myvector(4,99);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A a(x,y);creates an object calleda, calling a constructor ofAwith two parameters matching the types ofxandy, or any convertible types.So this:
Matches this constructor:
Which constructs a
vectorwith 4 elements of value 99 and calls itmyvector. This constructor is called because the first parameter can be converted to asize_type, which is also atypedef, defined to an integral type (usuallyunsigned long).