![]() |
Initialization of vectors in c++
Experimenting at home with visual c++, I see that int main()
{std::vector<double> vect(5);} creates a vector whose 5 initial values are all 0. Is this standard or might the five initial values be different from 0? I'm a bit surprised by this as I would expect vect to consist of five uninitialized doubles. Why is it that double x; introduces a double which is uninitialized and yet the above vect is initialized? Or is this just a matter of the definition of the c++ language which should just be accepted, and can't be derived from some other principle? Thank you, Paul Epstein |
| All times are GMT. The time now is 01:18 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.