[libcxx-commits] [libcxx] [libc++][span] LWG4243: `as_bytes`/`as_writable_bytes` is broken with `span<volatile T>` (PR #200993)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 1 23:38:19 PDT 2026


================
@@ -23,6 +23,11 @@
 
 #include "test_macros.h"
 
+template <class T, std::size_t Extent = std::dynamic_extent>
+constexpr bool hasAsBytes() {
+  return requires(std::span<T, Extent> s) { std::as_bytes(s); };
+}
----------------
frederick-vs-ja wrote:

I believe it's clearer to use a concept here (same for `hasAsWritableBytes`).

https://github.com/llvm/llvm-project/pull/200993


More information about the libcxx-commits mailing list