Reference or Value Semantics for Graph Traversal Range

"Nordlöw" via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Feb 18 05:37:55 PST 2015


I've written a Dijkstra-style graph traversal range at

https://github.com/nordlow/justd/blob/master/knet/traversal.d#L105

that needs to internally store the AA distance map in member 
variable distMap.

1.

All the data members except distMap have reference semantics. 
Therefore I've made my range a class instead of a struct. Is this 
the correct way to do it?

2.

To make it a ForwardRange I've also add a save() member. For now 
I've hardcoded the single member that needs to be duped. Is this 
correct way of doing it?


More information about the Digitalmars-d-learn mailing list