I have been writing my own hashmap which can provide forward ranges usable in @safe pure nothrow functions, because it's going to be useful for creating graph data structures with the same. I came to writing my ranges and I figured out how to do everything right for just mutable hashmaps, but I have no idea how to manage the tail-const nature of ranges in a variety of combinations. I figured out that I need to satisfy the following constraints.

Create a mutable KeyRange over a map which forwards on the right constness for the key type, so the following must be true.

HashMap!(K, V).keys.front -> K
const(HashMap!(K, V)).keys.front -> const(K)
immutable(HashMap!(K, V)).keys.front -> immutable(K)

I have encounted some difficulty in trying to write a range which does this.

Reply via email to