Passing anonymous enums as function parameters

kerdemdemir kerdemdemir at gmail.com
Sun Dec 17 11:49:58 UTC 2017


I have an enum statement :

enum : string
{
     KErdem
     Ali
     Zafer
     Salih
     //etc...
}


I don't want to give a name to my enum class since I am accessing 
this variables very often.

But I also have a function like:

double ReturnCoolNess( /* Is there any way? */ enumVal )
{
   switch (enumVal)
   {
	case KErdem:
	{
		return 0.0
	}
	case Ali:
	{
		return 100.0;	
	}
	case Salih:
	{
		return 100.0;	
	}
         // etc..
   }
}

Is there any way I still keep my enum anonymous and be able to 
call functions with different enumarations. Or is there any other 
way to call named enums without type name ?


More information about the Digitalmars-d-learn mailing list