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: address@hidden
Subject: Re: avoiding forward declarations in stencil.hh
Date: Mon, 30 Jan 2012 12:56:50 +0100

On Jan 30, 2012, at 12:39 PM, Han-Wen Nienhuys wrote:

> 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.


Thanks for the quick reply!

The problem is that the file in question is stencil.hh.
I got around it by using Drul_array<SCM> and having the drul arrayed populated 
with smobified stencils.

Cheers,
MS


reply via email to

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