Return types of the methods of a struct
Baz via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jun 19 06:41:31 PDT 2015
On Friday, 19 June 2015 at 13:40:01 UTC, Baz wrote:
> 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:
>>> [...]
>>
>> 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'.
Ah, damn, haven't see Steven Schveighoffer answer while i was
writing. cross post. same thing.
More information about the Digitalmars-d-learn
mailing list