copy constructor for a class with a const reference member...
hello, i'm struggling to come up with the correct syntax.
Code:
class Foo
{
public:
Foo(const Bar& bar);
private:
const Bar& m_bar;
};
Foo::Foo(const Bar& bar)
: m_bar(bar)
{ }
that works and compiles...until i put Foo into a vector, and it complains i don't have a assignment operator.
ok, so i define one...but now i have a problem where i don't want to change the m_bar reference because i can't assign it something else...
is there a way around this?