• Advertisement
Sign in to follow this  

Using enum constants in initialization list

This topic is 591 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello!

 

I'm registering some enums, i.e. TmColors = {clWhite, clBlack etc...}

and trying to use it in initialization lists:

 

array<int> a={clWhite,clBlack};

 

and have no result - array elements are empty.

What i do wrong?

Share this post


Link to post
Share on other sites
Advertisement

Thanks for answer!

I solved it (it works). Really it for dictionary type:

in buffer constructor adding code fragment for enum type in buffer:

 

if( typeId >= asTYPEID_INT8 && typeId <= asTYPEID_DOUBLE )

{...

}

// ADDED:

else if(engine->GetTypeInfoById(typeId)->GetFlags() & asOBJ_ENUM)
{typeId=asTYPEID_UINT32;
Set(name, (asINT64)*(unsigned int*)ref);
}

 

I think for other containers it is same case.

Share this post


Link to post
Share on other sites

I have verified my code with list initializations. Sorry, my bad - i tryed to add implicit casting to CScriptDictValue and it had cause confusion.

Thanks for you answers!

Edited by VoidSpirit

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement