Sane C++ Libraries
C++ Platform Abstraction Libraries
SC::StrongID< TagType, IDType, InvalidValue > Struct Template Reference

Strongly typed ID (cannot be assigned incorrectly to another ID) More...

#include <VectorMap.h>

Public Member Functions

constexpr StrongID (IDType value)
 
constexpr bool operator== (StrongID other) const
 
constexpr bool operator!= (StrongID other) const
 
constexpr bool isValid () const
 Check if StrongID is valid. More...
 

Static Public Member Functions

template<typename Container >
constexpr static StrongID generateUniqueKey (const Container &container)
 Generates an unique StrongID for a given container. More...
 

Public Attributes

IDType identifier
 

Detailed Description

template<typename TagType, typename IDType, IDType InvalidValue>
struct SC::StrongID< TagType, IDType, InvalidValue >

Strongly typed ID (cannot be assigned incorrectly to another ID)

Template Parameters
TagTypeAn empty class used just to tag this StrongID with a strong type
IDTypeThe primitive type (typically int or similar) used to represent the ID
InvalidValueThe sentinel primitive value that represents an invalid state of the ID

Member Function Documentation

◆ generateUniqueKey()

template<typename TagType , typename IDType , IDType InvalidValue>
template<typename Container >
constexpr static StrongID SC::StrongID< TagType, IDType, InvalidValue >::generateUniqueKey ( const Container &  container)
inlinestaticconstexpr

Generates an unique StrongID for a given container.

Template Parameters
ContainerA container with a Container::contains member
Parameters
containerThe instance of container
Returns
A StrongID that is not contained in Container

◆ isValid()

template<typename TagType , typename IDType , IDType InvalidValue>
constexpr bool SC::StrongID< TagType, IDType, InvalidValue >::isValid ( ) const
inlineconstexpr

Check if StrongID is valid.


The documentation for this struct was generated from the following file: