EntityComponentMetaSystem/src/EC/Bitset.hpp

33 lines
707 B
C++
Raw Normal View History

#ifndef EC_BITSET_HPP
#define EC_BITSET_HPP
#include <bitset>
#include "Meta/TypeList.hpp"
2016-03-04 12:39:25 +00:00
#include "Meta/Combine.hpp"
namespace EC
{
template <typename ComponentsList, typename TagsList>
struct Bitset :
public std::bitset<ComponentsList::size + TagsList::size>
{
2016-03-04 12:39:25 +00:00
using Combined = EC::Meta::Combine<ComponentsList, TagsList>;
template <typename Component>
constexpr auto getComponentBit()
{
2016-03-04 12:39:25 +00:00
return (*this)[EC::Meta::IndexOf<Component, Combined>::value];
}
template <typename Tag>
constexpr auto getTagBit()
{
2016-03-04 12:39:25 +00:00
return (*this)[EC::Meta::IndexOf<Tag, Combined>::value];
}
};
}
#endif