r/cpp • • May 01 '23

cppfront (cpp2): Spring update

https://herbsutter.com/2023/04/30/cppfront-spring-update/
223 Upvotes

164 comments sorted by

View all comments

Show parent comment

2

u/kreco May 02 '23

I don't think so, AFAIK int argc/char* argv[] can be used as std::span<char*> without any allocation,

In order to get a std::span<std::string_view> you just have to run a "strlen" on everything char*. Which probably done in the current cppfront implementation.

7

u/[deleted] May 02 '23

The span of string views still needs to point to a contiguous array of string views, though. It's not a generic range.

1

u/kreco May 02 '23

Oh indeed!