*.o
*.swp
doxygen_html/
-
+compile_commands.json
+tags
EC/Manager.hpp
EC/EC.hpp)
+set(WillFailCompile_SOURCES
+ test/WillFailCompileTest.cpp)
+
add_library(EntityComponentSystem INTERFACE)
target_link_libraries(EntityComponentSystem INTERFACE pthread)
target_include_directories(EntityComponentSystem INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME UnitTests COMMAND UnitTests)
endif()
+add_executable(WillFailCompile ${WillFailCompile_SOURCES})
+set_target_properties(WillFailCompile PROPERTIES
+ EXCLUDE_FROM_ALL True
+ EXCLUDE_FROM_DEFAULT_BUILD True)
+add_test(NAME WillFailCompile_0
+ COMMAND ${CMAKE_COMMAND} --build . --target WillFailCompile --config $<CONFIGURATION>
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
+set_tests_properties(WillFailCompile_0 PROPERTIES WILL_FAIL True)
#include <algorithm>
#include <thread>
#include <mutex>
+#include <type_traits>
#ifndef NDEBUG
#include <iostream>
using BitsetType = EC::Bitset<ComponentsList, TagsList>;
private:
+ using ComponentsTuple = EC::Meta::Morph<ComponentsList, std::tuple<> >;
+ static_assert(std::is_default_constructible<ComponentsTuple>::value,
+ "All components must be default constructible");
+
template <typename... Types>
struct Storage
{
};
using ComponentsStorage =
typename EC::Meta::Morph<ComponentsList, Storage<> >::type;
+
// Entity: isAlive, ComponentsTags Info
using EntitiesTupleType = std::tuple<bool, BitsetType>;
using EntitiesType = std::vector<EntitiesTupleType>;
--- /dev/null
+#include <EC/Manager.hpp>
+
+struct NoDef
+{
+ NoDef(int a) : a(a) {}
+
+ int a;
+};
+
+struct WithDef
+{
+ WithDef() : a(0) {}
+
+ int a;
+};
+
+using EC::Meta::TypeList;
+
+int main()
+{
+ // should fail to compile because "NoDef" is not default constructible
+ EC::Manager<TypeList<WithDef, NoDef>, TypeList<>> manager;
+ return 0;
+}