Open k-dominik opened 1 year ago
Looks like on cf even the python 3.11 vigra package is built with MSVC 14.16
. I'll propose this as a workaround.
chatgpt says to look at the usage of std:sort
https://github.com/ukoethe/vigra/blob/master/vigranumpy/src/core/segmentation.cxx#L1176
It says that begin
and end
may be returning const iterators, which would be stopping sort
from swapping values, but I can't find anything about this.
i'm somewhat confused, but it feel like the iterators are defined in: https://github.com/ukoethe/vigra/blob/master/include/vigra/multi_array.hxx#L1923 https://github.com/ukoethe/vigra/blob/502d5bc7146bee0abf88f95396df22bfdda0f498/include/vigra/multi_array.hxx#L755
bummer, when I saw you recompiling I had the vague memory of fixing this - but apparently I haven't :/
I think we have to introduce cbegin and cend
Problem remains also with VS2022, see https://github.com/conda-forge/vigra-feedstock/pull/129
I've been tracking compilation issues with VS2019 compilers (I was using
14.29
, but I've found that the problem was most likely introduced in MSVC14.28
.I haven't found a solution (yet) but also don't want to forget everything the next time I get to it (or someone else looks into it).
The symptom:
following compilation error:
in the end the error occurs in MSVC STL:
algorithm(6928): error C3892: '_First': you cannot assign to a variable that is const
more details here, note I shortened the paths a little for readability:
I found a discussion related to the above error here: https://developercommunity.visualstudio.com/t/VS2019-1684---c-const-issue:-error-C/1320890#T-N1325280
Bottom line seems to be that the vigra iterator implementation is "wrong" and de-referencing a const iterator should not return a const reference.
I followed the trail a bit to
https://github.com/ukoethe/vigra/blob/574de5743342f67408e015823d375b1c00281630/include/vigra/multi_iterator.hxx#L312-L315
and
https://github.com/ukoethe/vigra/blob/574de5743342f67408e015823d375b1c00281630/include/vigra/multi_iterator_coupled.hxx#L661-L666
, and finally to
https://github.com/ukoethe/vigra/blob/574de5743342f67408e015823d375b1c00281630/include/vigra/multi_handle.hxx#L932-L940
.
As far as I understand the problem, the solution should be removing the const from the returned reference. However, I didn't manage to do it in a way that would compile.