Re:Data Structures and Algorithms Problems
by coder007 on Wednesday April 05, 2017 @02:19PM
(#14044296)
So you prefer to use std::array over C arrays?
[ Parent
| on HN ]
Re:Data Structures and Algorithms Problems
by user5994461 on Wednesday April 05, 2017 @02:28PM
(#14044371)
std::vector
What do you think std:array are?
Re:Data Structures and Algorithms Problems
by coder007 on Wednesday April 05, 2017 @02:35PM
(#14044429)
I 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.
Re:Data Structures and Algorithms Problems
by lossolo on Wednesday April 05, 2017 @02:32PM
(#14044401)
std::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.
Re:Data Structures and Algorithms Problems
by user5994461 on Wednesday April 05, 2017 @02:41PM
(#14044466)
The 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.