Closed harsszegi closed 10 months ago
What do I miss?
Modern defaults. The code compiles fine with version-1 defaults (godbolt).
The ambiguity stems from an unconstrained conversion constructor which has been deprecated a while ago. It is replaced by a constrained version if modern defaults are enabled: https://github.com/gsl-lite/gsl-lite/blob/34ba5141492a88912e2055e08cd1bdd6714431c5/include/gsl/gsl-lite.hpp#L3770-L3784
To enable version-1 defaults, define the preprocessor macro gsl_CONFIG_DEFAULTS_VERSION=1
, or if you consume gsl-lite via CMake, simply reference the gsl::gsl-lite-v1
target rather than just gsl::gsl-lite
. See https://github.com/gsl-lite/gsl-lite#version-semantics for more details on semantic differences between the versioned defaults.
Yeeha, and of course it works just fine! Thanks a lot @mbeutel !
Hi,
I have a code like this:
If I use std::span it compiles fine, however with gsl::span it says for both setlist calls that the overloaded calls are ambigous. Is there an explicit reason for this? (Same happens with std::array, however with std::vector it works fine). And obviously with explicit casting the inputs to gsl::span it also compiles fine. What do I miss?
Thanks,