|
Boost Users : |
Subject: Re: [Boost-users] Library Developers Battling Cyclic Header Dependency
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-03-16 14:41:16
On 16/03/2011 18:45, Ryan wrote:
> In the boost library system certain libraries need to be compiled and
> linked into a project. For example, libraries would need to be compiled
> to remove cyclic header dependencies. In the boost library system I
> coundn't find any .cpp files that would indecate a compilable library.
> So how do library developers create compilable files in the boost
> libraries? The following two files would need to be broken up and
> compiled to remove the dependencies, correct?
> Ryan
> //File A.hpp
> class B;
> class A {
> double x;
> public:
> B convertToB(void) {
> return B(x);
> }
> };
> //File B.hpp
> class A;
> class B {
> double y;
> public:
> A convertToA(void) {
> return A(y);
> }
> };
Just move the definitions of convertToB and convertToB to other files.
Whether they're headers or not is irrelevant (you'll need to qualify
inline explicitly if they're in headers though).
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net