r/cpp • • Aug 11 '23

Making your own array

https://muit.xyz/posts/making-your-own-array/
12 Upvotes

39 comments sorted by

View all comments

Show parent comments

1

u/ts826848 Aug 13 '23

That strategy is not guaranteed to work, as described in the article you originally replied to.

1

u/[deleted] Aug 13 '23

[removed] — view removed comment

1

u/ts826848 Aug 13 '23

I'm not sure I'm understanding you correctly. So given a T* item and std::span<T> span, you're saying to check whether item points inside span you get char* ptr = reinterpret_cast<char*>(item) then... what?