digitalmars.D.learn - Acces Values in DList
- axwro (6/6) Aug 23 2014 How can i access values in DList?
- axwro (2/8) Aug 23 2014 Fixed, i just used Array!Property
- monarch_dodra (10/22) Aug 23 2014 DList implements what is known as a "(doubly) linked list". It is
How can i access values in DList? I save different objects of type "Property" in my DList, but if i want to access them this way: this.properties[0].value.start i get: Error: no [] operator overload for type DList!(Property)
Aug 23 2014
On Saturday, 23 August 2014 at 14:54:55 UTC, axwro wrote:How can i access values in DList? I save different objects of type "Property" in my DList, but if i want to access them this way: this.properties[0].value.start i get: Error: no [] operator overload for type DList!(Property)Fixed, i just used Array!Property
Aug 23 2014
On Saturday, 23 August 2014 at 15:18:15 UTC, axwro wrote:On Saturday, 23 August 2014 at 14:54:55 UTC, axwro wrote:DList implements what is known as a "(doubly) linked list". It is a container type that is not capable of providing random acess. As such, you cannot do "properties[0]". You can either access the first ("front") value individually, or iterate your DList (via its range interface "foreach(val; this.properties[]) {...}"). Array implements a basic contiguous sequence of elements (hence provides RA). It is important you understand what you are using, and which container best fits your needs.How can i access values in DList? I save different objects of type "Property" in my DList, but if i want to access them this way: this.properties[0].value.start i get: Error: no [] operator overload for type DList!(Property)Fixed, i just used Array!Property
Aug 23 2014