Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

immer::array fix to prevent breakage with glm library #205

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nghiaho12
Copy link

@nghiaho12 nghiaho12 commented Apr 1, 2022

Tested with the following code

#include <glm/glm.hpp>
#include "immer/array.hpp"

int main() {
    immer::array<glm::vec3> pos = {
        {0.f, 0.f, 0.f}
    };
}`

The error is

./immer/detail/arrays/with_capacity.hpp:131:22: error: invalid static_cast from type ‘const glm::vec<3, float, (glm::qualifier)0>*’ to type ‘immer::detail::arrays::with_capacity<glm::vec<3, float, (glm::qualifier)0>, immer::memory_policy<immer::free_list_heap_policy<immer::cpp_heap>, immer::refcount_policy, immer::spinlock_policy> >::size_t {aka long unsigned int}’
         auto count = static_cast<size_t>(distance(first, last));

glm provides a distance function which gets used by immer, somehow ...

@nghiaho12 nghiaho12 changed the title distance to std::distance, prevents breakage with glm library immer::array fix to prevent breakage with glm library Apr 1, 2022
@arximboldi
Copy link
Owner

It gets used because of ADL, to allow for iterators to customize it.

I feel like GLM is in the wrong here. Still my implementation looks a bit odd: there should be a using std::distance just before the use of it. I don't think that adding that would solve your issues though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants