Changed Bitset to use Combined lists

This commit is contained in:
Stephen Seo 2016-03-04 21:39:25 +09:00
parent a503eb628d
commit 9c5894520f

View file

@ -4,6 +4,7 @@
#include <bitset>
#include "Meta/TypeList.hpp"
#include "Meta/Combine.hpp"
namespace EC
{
@ -11,16 +12,18 @@ namespace EC
struct Bitset :
public std::bitset<ComponentsList::size + TagsList::size>
{
using Combined = EC::Meta::Combine<ComponentsList, TagsList>;
template <typename Component>
constexpr auto getComponentBit()
{
return (*this)[EC::Meta::IndexOf<Component, ComponentsList>::value];
return (*this)[EC::Meta::IndexOf<Component, Combined>::value];
}
template <typename Tag>
constexpr auto getTagBit()
{
return (*this)[ComponentsList::size + EC::Meta::IndexOf<Tag, TagsList>::value];
return (*this)[EC::Meta::IndexOf<Tag, Combined>::value];
}
};
}