ukoethe / vigra

a generic C++ library for image analysis
http://ukoethe.github.io/vigra/
Other
406 stars 191 forks source link

std::allocator<T>: use of 'construct' and 'destroy' deprecated since C++17 #532

Open mkrausex opened 1 year ago

mkrausex commented 1 year ago

Vigra currently does not compile with Visual Studio 2019 in C++20 mode because of the use of the deprecated functions mentioned in the issue title (which have been removed in C++20).

I would suggest to replace that with the corresponding functionality from std::allocator_traits (as in the attached patch), however that has only been available since C++11, and I don't know whether Vigra is still required to work with pre-C++11 compilers?

hmaarrfk commented 1 year ago

If we merge https://github.com/ukoethe/vigra/pull/514 would you be able to add a job for C++20 compatibility given our infrastructure?

hmaarrfk commented 1 year ago

your patch also seems trivial to wrap in ifdefs to have compatibility C++ before 11.

mkrausex commented 1 year ago

[...] would you be able to add a job for C++20 compatibility given our infrastructure?

I am not sure what exactly this involves -- extend azure-pipelines.yml, and that's it? Is VS2019 usable as a compiler there?

So far, I haven't even used the CMake-based build system of Vigra (my project has been using the Vigra header files directly). I've just tried to compile the full unit-test suite here on my computer using CMake for the first time. I enabled C++20 by adding set(CMAKE_CXX_STANDARD 20) to the main CMakeLists.txt, and used Visual Studio 2022. Beyond the issues I reported today, a couple of other errors pop up there (seems like my own project hasn't been including all of Vigra ...), which we would need to fix as well for a successful CI run (but that seems doable).

mkrausex commented 1 year ago

your patch also seems trivial to wrap in ifdefs to have compatibility C++ before 11.

The question is whether this is necessary: you have #511 on your revival checklist, which (because it uses a lambda) would already make C++11 the minimum required C++ standard for Vigra. (On the other hand, the lambda is only used in a .cxx, not in the header-only core implementation of Vigra...)

hmaarrfk commented 9 months ago

If you make a PR I think it is fine to merge and drop compatibility for before C++11, users can pin to version 1.11.1.

Thank you for your patience.