mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 17:01:24 +12:00
typeindices.hpp - start index from 0
Starting it from 1 makes it more error-prone to use.
This commit is contained in:
parent
92e6dee60f
commit
11a43e25d7
2 changed files with 14 additions and 37 deletions
|
@ -9,8 +9,8 @@ namespace stx
|
|||
template <typename Info>
|
||||
class type_info final : public Info
|
||||
{
|
||||
// Current type id (non-zero)
|
||||
unsigned type = 0;
|
||||
// Current type id (starts from 0)
|
||||
unsigned type = 0u - 1;
|
||||
|
||||
// Next typeinfo in linked list
|
||||
type_info* next = nullptr;
|
||||
|
@ -45,7 +45,7 @@ namespace stx
|
|||
|
||||
unsigned count() const
|
||||
{
|
||||
return next->index();
|
||||
return next->index() + 1;
|
||||
}
|
||||
|
||||
class const_iterator
|
||||
|
@ -114,7 +114,7 @@ namespace stx
|
|||
template <typename Info>
|
||||
type_info<Info>::type_info(Info info, decltype(sizeof(int))) noexcept
|
||||
: Info(info)
|
||||
, type(typeinfo_v<Info>.count() + 1)
|
||||
, type(typeinfo_v<Info>.count())
|
||||
{
|
||||
// Update linked list
|
||||
typeinfo_v<Info>.next->next = this;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue