Subject: Re: [Boost-users] Library Developers Battling Cyclic Header Dependency
From: Ryan (mccorywork_at_[hidden])
Date: 2011-03-16 15:52:07


//File A.hpp
class B;

class A {
 double x;
public:
 B inline convertToB(void);
};

#include <A_detail.hpp>

//File B.hpp
class A;

class B {
 double y;
public:
 A inline convertToA(void);
};

#include <B_detail.hpp>

//File A_detail.hpp
#include <B.hpp>
B A::convertToB(void) {
 return B(x);
}
//File B_detail.hpp
#include <A.hpp>
A B::convertToA(void) {
 return A(y);
}

The compiler is giving the error that it can't access the private members.
Once the forward declaration is used the compiler can't seem to use the full
class later.

Ryan