BinaryHeap is a range so it goes in std.range. Agree?
Steven Schveighoffer
schveiguy at yahoo.com
Tue Jun 8 09:19:01 PDT 2010
On Tue, 08 Jun 2010 11:53:06 -0400, Simen kjaeraas
<simen.kjaras at gmail.com> wrote:
> I hold that a range is a view that does not change the underlying data,
> and does not store all its data.
> That makes an array a container, which I feel is correct. It may still
> have range functionality, and thus be both, but it should be
> categorized as a container first.
This is not exactly correct in my opinion. A range that presents a
read-only view of the underlying data would unnecessarily exclude many
algorithms. I would say it's a view of the data which can change the
data, but not restructure the data (swapping two elements' values is not
restructuring, re-linking two linked list nodes is restructuring).
Essentially, it's a read-only view of the topology.
Array is special in that even the container itself cannot change its own
topology since it's based on contiguous memory which cannot be
restructured, so it can also be considered a range.
-Steve
More information about the Digitalmars-d
mailing list