Fix to Meta/Matching

This commit is contained in:
Stephen Seo 2016-03-13 18:17:06 +09:00
parent f123f075eb
commit c6002149d3
3 changed files with 19 additions and 0 deletions

View file

@ -12,6 +12,7 @@ namespace EC
template <typename TTypeListA, typename TTypeListB> template <typename TTypeListA, typename TTypeListB>
struct MatchingHelper struct MatchingHelper
{ {
using type = TypeList<>;
}; };
template <typename TTypeListA, typename TTypeListB, typename... Matching> template <typename TTypeListA, typename TTypeListB, typename... Matching>

View file

@ -1,6 +1,8 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <iostream>
#include <tuple> #include <tuple>
#include <EC/Meta/Meta.hpp> #include <EC/Meta/Meta.hpp>
#include <EC/EC.hpp> #include <EC/EC.hpp>
@ -102,5 +104,15 @@ TEST(EC, Manager)
std::size_t edata = std::get<std::size_t>(manager.getEntityInfo(0)); std::size_t edata = std::get<std::size_t>(manager.getEntityInfo(0));
EXPECT_EQ(edata, 1); EXPECT_EQ(edata, 1);
std::size_t e2 = manager.addEntity();
manager.addTag<T0>(e2);
auto updateTagOnly = [] (std::size_t id) {
std::cout << "UpdateTagOnly was run." << std::endl;
};
manager.forMatchingSignature<EC::Meta::TypeList<T0> >(updateTagOnly);
} }

View file

@ -227,5 +227,11 @@ TEST(Meta, Matching)
bool isSame = std::is_same<ListSome, Matched>::value; bool isSame = std::is_same<ListSome, Matched>::value;
EXPECT_TRUE(isSame); EXPECT_TRUE(isSame);
} }
{
using Matched = EC::Meta::Matching<ListTagsAll, ListComponentsAll>::type;
bool isSame = std::is_same<EC::Meta::TypeList<>, Matched>::value;
EXPECT_TRUE(isSame);
}
} }