We are playing around with std::span()
(using the gsl implementation for now) at work. Recently we discovered that comparing a std::span.size()
to a vector.size()
was giving a -Wsign-compare error
:
if( span.size() > vector.size() ) // comparison between signed and unsigned integer expressions [-Wsign-compare]
I don't think we want to cast at every one of these comparisons. Our coding guidelines treat these warnings as errors. Curious if anyone has any ideas or suggestions?
You could use iterators and have both use the function
std::distance()
.