this post was submitted on 11 Apr 2024
27 points (93.5% liked)

C++

2038 readers
4 users here now

The center for all discussion and news regarding C++.

Rules

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] WolfLink@lemmy.ml 4 points 1 year ago (2 children)

Tbh if you aren’t already using someone else’s array implementation that includes length information, just write your own simple wrapper e.g.

struct MyArrayWrapper { int *data; int length; }

[–] clyne@discuss.tchncs.de 2 points 1 year ago

At that point I would just use std::span if you can, then you also get the standard container/iterator interfaces for free.

load more comments (1 replies)