opIndex operators

bearophile bearophileHUGS at lycos.com
Sun Apr 14 04:54:13 PDT 2013


gedaiu:

> Value[Value] container;
>
> ref Value opIndex(Value index) {
> 	return container[index];
> }
>
> why I get this error?
>
> Error: function base.Value.Value.opIndex (Value index) is not 
> callable using argument types (string)
> Error: cannot implicitly convert expression ("string") of type 
> string to Value
>
> I have implemented this methods:
> this(string)
> Value opCast(string val)
> Value opAssign(ref const string val)

When possible it's better to show the actual code, and 
double-bonus if it's complete and compilable (or supposed to be 
compilable).

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list