Open camio opened 1 day ago
The CRTP implementation isn't that crazy to do, but there might be edge/corner cases that behave slightly differently?
Feature test macros and std version checks are a good way of getting ODR violations if someone mixes them. It's the main reason to avoid setting it within a Cmake project.
Feature test macros and std version checks are a good way of getting ODR violations if someone mixes them.
I agree. We had this problem with https://github.com/stlab/libraries. We successfully mitigated it by generating a config.hpp
at CMake time for the project.
This code, unlike the implementation used in beman.optional26, depends on deducing *this, a C++23 feature. This dependency makes it impossible to evaluate the library in projects that are using C++20 and earlier toolchains.
We could conditionally compile an implementation that doesn't depend on deducing *this, but this changes the interface. With deducing this, note that the CRTP isn't used,
With the Boost, version, the CRTP is used. Note the
Derived
template argument.Here are some possible ways to address this:
iterator_interface_crtp
which doesn't use deducing *this.