Hello all,
The code below is not legal (problem with the foo_t initializer list)
because:
"A reference that is not to 'const' cannot be bound to a non-lvalue"
How can I best achieve an effect similar to what this code attempts?
Thanks,
Dave
class bar_t
{
};
class foo_t
{
public:
foo_t(): ref(bar_t()) {}
private:
bar_t &ref;
};
void foo()
{
foo_t a;
}
int main()
{
foo();
return 0;
}
The code below is not legal (problem with the foo_t initializer list)
because:
"A reference that is not to 'const' cannot be bound to a non-lvalue"
How can I best achieve an effect similar to what this code attempts?
Thanks,
Dave
class bar_t
{
};
class foo_t
{
public:
foo_t(): ref(bar_t()) {}
private:
bar_t &ref;
};
void foo()
{
foo_t a;
}
int main()
{
foo();
return 0;
}
Comment