Need for (C++20) Contiguous Range
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Fri Oct 9 16:05:32 UTC 2020
On Friday, 9 October 2020 at 15:44:27 UTC, Steven Schveighoffer
wrote:
> What can you do when defining something that isn't an array as
> contiguous memory? What are the primitives that you use, for
> what purpose?
Ok, so here is another example. Priority queue. Traversing it in
order would jump over the place and be slow. A sequential scan
has major cache-prefetch benefits.
All you need is a new filter "unordered", when that is applied to
a container that provides an unordered contiguous memory
interface it can do a sequential scan.
So you would get:
"container.somerangefunction" is in order, but slow.
"container.unordered.somerangefunction" may not be in order, but
is fast.
More information about the Digitalmars-d
mailing list