Need for (C++20) Contiguous Range
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.com
Thu Oct 8 17:49:30 UTC 2020
On 10/8/20 9:30 AM, Per Nordlöw wrote:
> C++20 defines
>
> - std::ranges::contiguous_range [1] on top of
> - std::random_access_iterator [2]
>
> as specializations of
>
> - std::ranges::random_access_range on top of
> - std::random_access_iterator
>
> . A contiguous ranges has all its elements stored continuously
> (adjacently) in memory.
>
> Does anybody know the application for this concept/predicate?
>
> [1] https://en.cppreference.com/w/cpp/ranges/contiguous_range
> [2] https://en.cppreference.com/w/cpp/iterator/contiguous_iterator
It occured to me we could define that traite, but we got away without it
by implicitly decreeing that anything contiguous is just supposed to be
a T[].
There would be a few cases where that could be useful, i.e. the result
of map() over a T[]. But we'd need a strong case on why it would be
useful to distinguish that from a random-access range.
More information about the Digitalmars-d
mailing list