Why won’t this build in VS 2010 C++?
typedef float test[10];
std::vector<test> test_me(100); // wanted initial capacity of 100
While this builds fine
typedef float test[10];
std::vector<test> test_me_now;
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.
Arrays are neither copy constructible, nor move constructible.
std::vectorrequires at least one of those for most operations. Or at least, the operations that involve actually putting things into the vector. Since the default constructor doesn’t put anything into the vector, there’s no problems using it.The unbecoming behavior of built-in arrays is why
std::arraywas invented.