I have a class inheriting from boost::noncopyable; let's say with an excerpt of the header as follows:
class A : boost::noncopyable {
...
blah
...
private:
struct impl;
boost::scoped_ptr<impl> m_impl;
};
Then in one of the projects of my solution I have a class (which is also inherited from boost::noncopyable), one whose private members in the implementation details are a reference to an object of type A, say, in the header excerpt:
class B : boost::noncopyable {
...
blah
...
private:
struct impl;
boost::scoped_ptr<impl> m_impl;
};
and in the statement of implementation (cpp):
struct B::impl {
impl(A& a) : m_a(a) {}
set_A(A& a) {m_a = a;}
A& m_a;
...
}
B(A& a) : m_impl(new impl(a)) {}
...
Then in another project of my solution, I have a class C inheriting from B, say, with a header excerpt:
class C : public B {
...
blah;
...
private:
struct impl;
boost::scoped_ptr<impl> m_impl;
};
and in the statement of implementation (cpp):
struct C::impl {
impl(A& a) : m_a(a) {}
void set_A(A& a) {m_a = a;}
A& m_a;
};
C(A &a) : B(a), m_impl(new impl(a)) {}
...
But when I try to build in MSVC ++ 2008, I get the following error:
error C2248: 'boost::noncopyable_::noncopyable::operator =' : cannot access private member declared in class 'boost::noncopyable_::noncopyable'
see declaration of 'boost::noncopyable_::noncopyable::operator ='
error C2248: 'boost::scoped_ptr<T>::operator =' : cannot access private member declared in class 'boost::scoped_ptr<T>' with T = A::impl
This diagnostic occurred in the compiler generated function 'A& A::operator =(const A&)'
The compiler has only problem with the C function set_Ainstead Bed and set_A. Appreciate if anyone has any ideas on this and can shed some light? Thank you, as always, for your interest.
Edit:
, , , boost::noncopyable. set_A(..) C, . , , B. , . , - . , C - ? ?