skaarj1989 / entt-meets-sol2

Use EnTT in Lua with Sol2
Creative Commons Zero v1.0 Universal
47 stars 4 forks source link

C++20 errors. #2

Closed SomeGuyDoinWork closed 5 months ago

SomeGuyDoinWork commented 5 months ago

Appears trying to compile app with C++20 leads to errors.

Error   C2672   'sol::resolve': no matching overloaded function found   C:entt_sol\dispatcher.hpp   172     

Error   C2664   'Sig (__cdecl *sol::resolve<void(void)>(Sig (__cdecl *)))(void)': cannot convert argument 1 from 'overloaded-function' to 'Sig (__cdecl *)'
        with
        [
            Sig=void (void)
        ]dispatcher.hpp 167     

also your

template<typename Component>
auto emplace_component(entt::registry* registry, entt::entity entity, const sol::table& instance, sol::this_state s)
{
    auto& comp = registry->emplace_or_replace<Component>(entity, instance.valid() ? instance.as<Component>() : Component {});
    return sol::make_reference(s, std::ref(comp));
}

is attempting to use a copy constructor not a move constructor.

refernece to deleted function const &.

skaarj1989 commented 5 months ago

Thank you for reporting the issue. I'll fix it right away. Regarding emplace_component, I already had the correct version in my engine