Skip to content

Commit

Permalink
RTTI2 fix compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rybochodonezzar committed Dec 30, 2019
1 parent 1d99d6c commit 5784074
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions PolyEngine/Core/Src/pe/core/rtti/RTTI2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ namespace pe::core::rtti
{
namespace RTTI2
{
TypeManager& get()
TypeManager& TypeManager::get()
{
static TypeManager instance{};
return instance;
}
}
}
}
12 changes: 6 additions & 6 deletions PolyEngine/Core/Src/pe/core/rtti/RTTI2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ namespace pe::core::rtti

namespace impl
{
template <typename F, typename X>
void runListImpl(F f, X x) { f(x); }

template <typename F, typename X, typename ... XS>
void runList(F f, X x, XS... xs)
void runListImpl(F f, X x, XS... xs)
{
f(x);
runList(f, xs...);
runListImpl(f, xs...);
}

template <typename F, typename X>
void runList(F f, X x) { f(x); }
}

constexpr auto runList = [](auto list, auto f) {
list([f](auto... xs){ impl::runList(f, xs...); });
list([f](auto... xs){ impl::runListImpl(f, xs...); });
};

namespace RTTI2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct TestClass : public virtual RTTI2::RTTIBase {
TestClass() : RTTI2::RTTIBase(RTTI2::TypeManager::get().registerOrGetType<TestClass>()) {}
};
template <> struct RTTI2::RTTIinfo<TestClass> {
constexpr static auto info = List(testAttr, testAttr, RTTI2::classname{ "testname" });
constexpr static auto info = List(testAttr, testAttr, RTTI2::ClassName{ "testname" });
};

TEST_CASE("RTTI2 simple attribute", "[RTTI2]") {
Expand All @@ -20,7 +20,7 @@ TEST_CASE("RTTI2 simple attribute", "[RTTI2]") {
CHECK(ta);
CHECK(ta->size() == 2);
CHECK(tc.typeInfo().get<int>() == nullptr);
auto x = tc.typeInfo().get<RTTI2::classname>();
auto x = tc.typeInfo().get<RTTI2::ClassName>();
CHECK(x);
CHECK(std::string("testname") == x->name);
}
Expand Down Expand Up @@ -73,4 +73,4 @@ TEST_CASE("RTTI2 derived", "[RTTI2]") {
CHECK(tcb.typeInfo().bases[0].get().id == tca.typeInfo().id);
CHECK(RTTI2::isSame<TestClassA>(tca.typeInfo()));
CHECK(RTTI2::isDerived<TestClassA>(tcb.typeInfo()));
}
}

0 comments on commit 5784074

Please sign in to comment.