I ran the following code
#include <vector>
#include <complex>
#define N 8192
int main() {
std::vector< std::complex<double> > input;
input.reserve(N);
for (size_t k = 0; k < N; k++) {
input[k] = std::complex<double>(k, 0.0);
}
}
in both codeBlocks and Visual Studios 2019. The latter gives the runtime error "vector subscript out of range", while in codeBlocks it runs fine. What is happening, and how can I fix this?