Return types of the methods of a struct

Baz via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jun 19 06:40:00 PDT 2015


On Friday, 19 June 2015 at 13:27:15 UTC, Quentin Ladeveze wrote:
> On Friday, 19 June 2015 at 13:26:03 UTC, Steven Schveighoffer 
> wrote:
>> On 6/19/15 9:13 AM, Quentin Ladeveze wrote:
>>> [...]
>>
>> You can't. The forum is backed by a newsgroup, just post the 
>> full corrected version :)
>>
>> -Steve
>
> Thank you :)
>
> Here is th corrected version :
>
> Hi,
>
>   I have a struct with some methods int it, let's say
>
> ```
> struct Example{
>    int a(){
>    	  return someValue;
>    }
>
>    float b(){
> 	  return someOtherValue;
>    }
>
>    string stringValue(){
>       return c;
>    }
> }
>
> Is there any way to have a asTuple method in this struct that 
> would returns something like :
>
> Tuple!(int, "a", float, "b", string, "c")
>
> and that will contain the values of the methods of the struct ?
>
> Thanks.

in the declaration set the return type to 'auto'.
Use 'tuple' instead of 'Tuple'.



More information about the Digitalmars-d-learn mailing list