c++ - large arrays, std::vector and stack overflow -


i have program reading data large arrays, divided program in 2 separate projects in visual studio , each 1 separately worked fine, when tried put them program acted funny skipping steps while debugging. i'm new on c++ started doing research , found maybe filling stack huge arrays , should try put them on heap instead.

i decided change each of arrays std::vector , initialize them way:

std::vector<double> meantimeao = { 0.4437, 0.441, 0.44206, 0.44632, 0.4508, 0.45425,...} 

but after changing of arrays when try compile compiler crashes stack overflow, thought liberating memory space stack changing arrays vector seems had opposite results, why that??

and how should deal these big arrays? (they fixed never changing values or size)

if array of fixed size, , elements don't change, there no real need use vector. use std::array, array of const or constexpr instead.

constexpr float meantimeao[] = { 0.4437f, 0.441f, 0.44206f, 0.44632f, 0.4508f, 0.45425f,...} 

Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -