Skip to content

Instantly share code, notes, and snippets.

@tosik
Last active June 13, 2018 07:47
Show Gist options
  • Save tosik/d86ef43c286f56d7beae84536e48def1 to your computer and use it in GitHub Desktop.
Save tosik/d86ef43c286f56d7beae84536e48def1 to your computer and use it in GitHub Desktop.
g++ -std=c++11 foo.cpp
foo.cpp:11:63: error: cannot increment value of type 'const std::__1::__wrap_iter<const T *>'
for (const auto & it = foo.begin() ; it != foo.end() ; it ++);
~~ ^
1 error generated.
make: *** [all] Error 1
#include <vector>
class T
{
};
int main()
{
const std::vector<T> foo = {};
for (const auto & it = foo.begin() ; it != foo.end() ; it ++);
for (auto && it = foo.begin() ; it != foo.end() ; it ++);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment