Re:Ill-Advised C++ Rant, Part 2 (2016)
by mattnewport on Wednesday October 25, 2017 @04:36PM
(#15553987)
You can also use the std::size() free function to get the size of a C array, an std::array or any other standard container.
Re:Ill-Advised C++ Rant, Part 2 (2016)
by stabbles on Wednesday October 25, 2017 @04:42PM
(#15554065)
A free function for this looks even better IMO.
Re:Ill-Advised C++ Rant, Part 2 (2016)
by ender341341 on Wednesday October 25, 2017 @04:12PM
(#15553711)
or just use std::extent which type safely gets the size of arrays (though most of my new c++ will probably be using std::array)
In C++17 you can do
which even deducts the type `std::array<int, 6>` for you.