How to iterate over const(RedBlackTree)?

Cooler kulkin at hotbox.ru
Thu Jan 2 03:23:38 PST 2014


Example:

const RedBlackTree!int rbt = redBlackTree(1, 2, 3);
foreach(i; rbt[])
   writeln(i);

dmd 2.064 give me error
"mutable method 
std.container.RedBlackTree!int.RedBlackTree.opSlice is not 
callable using a const object"

Without "const" keyword the example compiled and works fine.

How can I iterate over const?


More information about the Digitalmars-d mailing list