immer
immer copied to clipboard
immer::array fix to prevent breakage with glm library
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 ...
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...