Is it only my compiler or is it forbidden to use cons references in std::vector elements. Consider following structure:
struct Y
{
const int & x;
Y(const int & p_x):
x(p_x)
{
}
};
Now, when I try to push such object onto vector:
std::vector<Y> yv;
int x = 5;
Y y(x);
yv.push_back(y);
I get compiler error: "error: non-static reference member `const int&Y::x', can't use default assignment operator". Shouldn't copy ctor be enough?