Entix’s core types#
Basic integer types
Id template type
#include <Entix/Core/Types.h>-
template<typename T, typename Tag>
class Id# Id template type.
Usage example:
struct MyIdTag {}; struct MyIdTag2 {}; void IdTest() { Id<Usize, MyIdTag> myId = 10; Id<Usize, MyIdTag2> myId2 = 10; // This is error. You can't compare different Id types implicitly if(myId == myId2) { // Do something... } // Following convertion are acceptable. // // Convertion are available when Id type // are convertable or the same (std::is_convertible_v || std::is_same_v) if(myId == (Id<Usize, MyIdTag>)myId2) { // Do something... } }
Following code doing the same but with macro:
EX_DEFINE_ID_TYPE(MyId); EX_DEFINE_ID_TYPE(MyId2); void IdTest() { MyId myId = 10; MyId2 myId2 = 10; // This is error. You can't compare different Id types implicitly if(myId == myId2) { // Do something... } // Following convertion are acceptable. // // Convertion are available when Id type // are convertable or the same (std::is_convertible_v || std::is_same_v) if(myId == (MyId)myId2) { // Do something... } }
- Template Parameters:
Public Functions
-
EX_DEFINE_ID_TYPE(NAME)#
Defines Id type from template.
Creates a empty tag structure and defines Id type with following template parameters:
Id<Usize, TAG_STRUCTURE>- Parameters:
NAME – [in] You Id type name. Tag structure are named as
NAME##Tag
Basic string types