Raised This Month: $276 Target: $400
 69% 

Enum Structs Available This Holiday Season


Post New Thread Reply   
 
Thread Tools Display Modes
AdRiAnIlloO
Junior Member
Join Date: Jul 2015
Location: Spain
Old 06-25-2020 , 05:14   Re: Enum Structs Available This Holiday Season
Reply With Quote #41

Quote:
Originally Posted by Deather View Post
There is also a problem with using the same struct type as a method argument type:
Code:
enum 
struct STest
{
    int a;

    void Add(STest x)
    {
       a += x.a;
    }
}
STest test;
Right, it seems you can't use same enum struct inside one's definition. Though you also need to always prefix self members with this. (so this.a in your example), otherwise it's an error.

Also, I wanted to suggest. I think enum structs should support constructors, I guess it would be easy since they allow for normal functions already, and it would be the most natural next-step for me. In relation to this, the fact that methodmaps have constructors already wouldn't be a reason for not making same on enum structs - methodmaps can't contain member variables.

Once this is done, enum structs will be much more valuable.

Last edited by AdRiAnIlloO; 07-01-2020 at 06:41.
AdRiAnIlloO is offline
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 06-27-2020 , 03:33   Re: Enum Structs Available This Holiday Season
Reply With Quote #42

Quote:
Originally Posted by AdRiAnIlloO View Post
Right, it seems you can't use same enum struct inside one's definition. Though you also need to always prefix members with this. (so a.this in your example), otherwise it's an error.

Also, I wanted to suggest. I think enum structs should support constructors, I guess it would be easy since they allow for normal functions already, and it would be the most natural next-step for me. In relation to this, the fact that methodmaps have constructors already wouldn't be a reason for not making same on enum structs - methodmaps can't contain member variables.

Once this is done, enum structs will be much more valuable.
this.a (which means this STest.a), not a.this
__________________

Last edited by MAGNAT2645; 06-27-2020 at 03:34.
MAGNAT2645 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:19.


Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode