Add INVALID_ID as a constant for Id class Template

This is for identifying invalid ID from normal ID.
This commit is contained in:
Ka Ho Ng 2018-01-19 23:45:53 +08:00 committed by Fangrui Song
parent 427f7b79e3
commit b6539a2639

View File

@ -35,6 +35,8 @@ template <typename T>
struct Id {
size_t id;
static constexpr size_t INVALID_ID = static_cast<size_t>(-1);
Id() : id(0) {} // Needed for containers. Do not use directly.
explicit Id(size_t id) : id(id) {}