c/cpp · by lysdexic@programming.dev · 2yHow not to check array size in C++ https://pvs-studio.com/en/blog/posts/cpp/1112/27 points · 3 comments · view on lemmy.world
3 Comments
WolfLink@lemmy.ml · 4 pts · 2y
Tbh if you aren’t already using someone else’s array implementation that includes length information, just write your own simple wrapper e.g.
clyne@discuss.tchncs.de · 2 pts · 2y
At that point I would just use std::span if you can, then you also get the standard container/iterator interfaces for free.
xep@fedia.io · 1 pts · 2y
The article did mention that that's what you'd probably have to do.