Skip to content

Switch to c++17

Julien Osman requested to merge cpp17 into develop

Summary

Upgrade to the C++ 2017 standard

Rationale

OTB is currently compiled with c++14. Now that the c++17 standard is well implemented by the compilers, we could upgrad to c++17. This would come with a lot of advantages:

  • There are a lot of TODOs in the code telling that when we switch to c++17 we will be able to simplify that part of code.
  • The new std::clamp is useful (and could simplify !797 (merged)).
  • We will be able to remove the homemade emulation of the string_view, and use the standard one.
  • A bunch of new algorithms and mathematical functions.
  • Some new features concerning the templates
  • The new if constexpr will be handful to simplify the code.
  • Many other goodies.

This update means we drop support for older compilers (like VisualC++14).

Implementation Details

Modify CMAKE_CXX_STANDARD to 17 in main CMakeFiles.txt.

Remove the REGISTER keyword from 6S code.

Copyright

The copyright owner is CNES and has signed the ORFEO ToolBox Contributor License Agreement.


Check before merging:

  • All discussions are resolved
  • At least 2 👍 votes from core developers, no 👎 vote.
  • The feature branch is (reasonably) up-to-date with the base branch
  • Dashboard is green
  • Copyright owner has signed the ORFEO ToolBox Contributor License Agreement
  • Optionally, run git diff develop... -U0 --no-color | clang-format-diff.py -p1 -i on latest changes and commit
Edited by Julien Osman

Merge request reports