Is there a way not to “use” the loop variable in a range-based loop, but also to avoid warning the compiler that it is not in use?
In context, I am trying to do something like the following. I have “handle warnings as errors,” and I would rather not hack how to make the variable “use,” meaninglessly mentioning it somewhere.
size_t getSize(const std::forward_list &list) { size_t count = 0; for (auto & : list)
I know there are other ways to do this, but let me say, for the sake of argument, that I need to use a range-based loop.
c ++ foreach c ++ 11
Karu Feb 15 '14 at 1:38 2014-02-15 01:38
source share