I ran into a strange issue when building the code with -Wconversion flag.
std::vector<int> values{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; std::uint8_t number_of_values = static_cast<uint8_t>(values.size());
The example above produces a warning:
warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
values.size() returns size_t, so static_cast to uint8_t should be OK.
Enviroment:
Ubuntu 18.04.2
icc (ICC) 19.0.3.199 20190206