push_back
ing to a vector of non-const elements works as expected:
std::vector<int> foo;
int bar = 0;
foo.push_back(bar);
But why is the following not possible?
std::vector<const int> foo;
const int bar = 0;
foo.push_back(bar);
More precisely, why is creating the foo
object possible but not calling push_back
on it?