SyntaxFix
Write A Post
Hire A Developer
Questions
Tags
I know in C++11 they added the feature to initialize a variable to zero as such
double number = {}; // number = 0 int data{}; // data = 0
Is there a similar way to initialize a std::vector of a fixed length to all zero's?
std::vector
This question is related to c++ c++11
c++
c++11
Initializing a vector having struct, class or Union can be done this way
std::vector<SomeStruct> someStructVect(length); memset(someStructVect.data(), 0, sizeof(SomeStruct)*length);
Source: Stackoverflow.com