8 ms·
So you prefer to use std::array over C arrays?
by coder007 9y ago
So you prefer to use std::array over C arrays?
- user5994461 9y agostd::vector What do you think std:array are?
- lossolo 9y agostd::array is stack allocated array with known size compile time. std::vector is dynamically allocated array (on heap). So C array equivalent = std::array, not std::vector.
- user5994461 9y agoThe point of the parent was to write C++ code the C++ way. Most arrays in real programs should be std::vector. Imitating C arrays with std::array is the perfect example of bastardized C/C++ code.
- lossolo 9y agoUsing std::array is writing code C++ way. If you know size of the array compile time and you know it will fit the stack then there is no reason to use std::vector.
- coder007 9y agoI know, just a class version of the C-array but std::vectors has lower performance. I believe that std::array or C array are good enough for problems with non-dynamic input.