lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: avoiding forward declarations in stencil.hh


From: Han-Wen Nienhuys
Subject: Re: avoiding forward declarations in stencil.hh
Date: Mon, 30 Jan 2012 09:39:53 -0200

On Mon, Jan 30, 2012 at 6:54 AM, address@hidden
<address@hidden> wrote:
> Hey all,
>
> I'm doing some work on the stencil class and I have a programming question.
>
> I'm experimenting with the following code:
>
> class Stencil
> {
>  Box dim_;
>  SCM expr_;
>  Drul_array<Stencil> children_;

> ../flower/include/drul-array.hh: In instantiation of 'Drul_array<Stencil>':
> ./include/stencil.hh:63:   instantiated from here
> ../flower/include/drul-array.hh:32: error: 'Drul_array<T>::array_' has 
> incomplete type
> ./include/stencil.hh:60: error: forward declaration of 'class Stencil'
> make: *** [out/articulations.o] Error 1
>
> When I change the Drul_array to a vector, this problem goes away.  I would, 
> however, like it to be a Drul_array (or even better, a pair, but pair gives 
> me the same forward declaration error as Drul_array).  Does anyone know a way 
> to declare this thing correctly so that I don't get the forward declaration 
> error?

It's not possible. A vector<X> internally creates a pointer to X,
which is why it doesn't need to know about X, but drul_array doesn't
work like that.

Just include stencil.hh and be done with it.

-- 
Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen



reply via email to

[Prev in Thread] Current Thread [Next in Thread]