On May 10, 2022, at 8:35 PM, Klemens Morgenstern via Boost
Hi y'all,
I've hacked together a cstring_view class and would like to ask if it could be included in boost.utility or boost.core.
https://gist.github.com/klemens-morgenstern/fc02dab8b37fc77ac80efbca30f297cf
The main motivation is to have a view that works with C-APIs. I also need the char_traits for dealing with odd char semantics for some system APIs. (e.g. environment keys on windows are char-insensitive but preserving).
I don’t see how this is supposed to maintain the invariant ( null temination) w/o it’s own storage. Consider: cstring_view sv; // is sv-data() pointing to a null-terminated string? If so, where did it come from? cstring_view sv1(“abcdefg”)’ sv1.substring(3, 2); // what’s the value of strlen(sv.data) here? How can it be 2? — Marshall