Return a const structure by reference.

Agustin agustin.l.alvarez at hotmail.com
Tue Oct 15 21:28:17 PDT 2013


I'm having trouble trying to return a const reference of a 
structure.

public struct Structure {
}

public class A {
     private Structure structure;

     this(Structure structure)
     {
         this.structure = structure;
     }

     public ref const Structure getStructure() const {
         return structure;
     }
}

cannot implicitly convert expression (this.structure) of type 
const(Structure) to Structure


More information about the Digitalmars-d-learn mailing list