RFC on range design for D2
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Sep 9 16:10:37 PDT 2008
Steven Schveighoffer wrote:
> "Andrei Alexandrescu" wrote
> I thought you stated that 'pointers' shouldn't be allowed, only ranges? In
> general, I agree with that, but I think the ability to use a pointer type
> instead of ranges has advantages in some cases.
I think there's a little confusion. There's three things:
1. Ranges
2. Iterators
3. Pointers, e.g. the exact address where the object sits in memory
My address uses 1 and drops 2. You still have access to 3 if you so need.
void showAddresses(R)(R r)
{
for (size_t i = 0; !r.isEmpty; r.next, ++i)
{
writeln("Element ," i, " is sitting at address: ", &(r.first));
}
}
Andrei
More information about the Digitalmars-d-announce
mailing list