On 10/15/2013 09:28 PM, Agustin wrote:

> 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 {

The two consts up there have exactly the same meaning: Even the first one qualifies the function (more correctly the implicit 'this' reference).

You want this:

    public ref const(Structure) getStructure() const {

>          return structure;
>      }
> }
>
> cannot implicitly convert expression (this.structure) of type
> const(Structure) to Structure

Ali

Reply via email to