opStar

Bill Baxter dnewsgroup at billbaxter.com
Mon Nov 12 13:00:35 PST 2007


Sean Kelly wrote:
> Walter Bright wrote:
>> Bill Baxter wrote:
>>> If you're not going to be able to access members and such via the 
>>> opStar, why not just have iterators use a convention like p.val to 
>>> access the value pointed too, rather than *p.  Why does it need to be 
>>> an operator?
>>
>> Because raw pointers don't have a .value property, and can't because 
>> then you'd have problems with pointers to structs that have a value 
>> member.
> 
> Sure.  But how much value is there in supporting pointers as iterators? 
>  Even the C++ community has moved away from this idea, although the 
> syntax still supports it.

True, true.  I almost never see raw pointers used as iterators in C++.
And you can always adapt a raw pointer with a struct that implements the 
iterator interface.  like pointer_iter(pBegin, pEnd).

--bb



More information about the Digitalmars-d mailing list