[libcxx-commits] [PATCH] D127418: [libc++] Use bounded iterators in std::span when the debug mode is enabled
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jun 9 11:11:10 PDT 2022
ldionne added a comment.
This approach has the benefit that we don't need to modify the container (`std::span`) at all, unlike with the usual `__wrap_iter` and `__debug_insert_c()` methods. It doesn't use a global locking mechanism and the internal debug "database". As a result, `std::span` can stay trivially copyable and trivially destructible, which could be important for the correctness of user programs.
On the downside, we also can't track any potential changes to the size of the container. Once an iterator is obtained, the bounds it considers will never change, even if the underlying container could potentially change its bounds. This is not a major issue for `std::span`, however it could potentially be an issue for other containers.
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the libcxx-commits