When I tried to bind a reference to a string iterator it doesn't work
#include <string>
int main()
{
std::string a;
auto &i = a.begin();
return 0;
}
But when i changed it to a reference to const it works
#include <string>
int main()
{
std::string a;
const auto &i = a.begin();
return 0;
}
Why does this happen ?