NEW275191
Make WTF containers std::ranges compatible
https://bugs.webkit.org/show_bug.cgi?id=275191
Summary Make WTF containers std::ranges compatible
Sam Weinig
Reported 2024-06-05 19:08:36 PDT
Many of the containers defined in WTF are not compatible with std::ranges, mostly due to invalid iterator implementations. To allow using std::ranges, we should update the implementations to conform to the associated concepts and then statically assert the concepts hold. The easiest way to test if a container is compatible with std::ranges is to compile the code: ``` static_assert(std::range<ContainerName>); ``` but in general, we should usually be further constraining things with a concept with more requirements. For instance, most of our containers have a known size, so they should at least be "std::sized_range<>". Similarly, iterators can now be statically asserted as conforming using the iterator concepts: "static_assert(std::forward_iterator<FooIterator>);"
Attachments
Radar WebKit Bug Importer
Comment 1 2024-06-12 19:09:13 PDT
Note You need to log in before you can comment on or make changes to this bug.