Re:Ill-Advised C++ Rant, Part 2 (2016)
by colanderman on Wednesday October 25, 2017 @03:41PM
(#15553401)
Did not know about that, though unfortunately it's C++17 only.
[ Parent
| on HN ]
Re:Ill-Advised C++ Rant, Part 2 (2016)
by bstamour on Wednesday October 25, 2017 @04:14PM
(#15553739)
Unfortunately yes. The implementation is straight forward though:
template <typename Container>
std::size_t size(Container const& c) { return c.size(); }
template <typename T, std::size_t K>
std::size_t size(T (&)[K]) { return K; }