Hello list,
while trying to get more insight into the engraver stuff, I encountered a
problem. I hope I can explain it:
I need some kind of a array of vectors:
vector<Stream_event*> slot_[max];
where I can store events later on by calling
slot_[i].push_back (event);
The index i lies in a fixed range from 0 to some value max, but it
isn't processed sequentially, so the calculations could start with i=4,
then comes i=0 etc.
As far as I understand c++, I cannot access i=4 directly if i=0...3
weren't accessed before.
So I tried to initialize the vector within initialize () as follows:
void
My_engraver::initialize ()
{
static int const max = 12;
vector<Stream_event*> slot_[max];
for (int i = 0; i < max; i++)
slot_[i] = 0;
};
but then slot_[] and max are not accessible in process_music ();
When I move the declarations to
class My_engraver : public Engraver
{
.
.
.
private:
static int const max = 12;
vector<Stream_event*> slot_[max];
.
.
.
}
void
My_engraver::initialize ()
{
for (int i = 0; i < max; i++)
slot_[i] = 0;
};
then I got
error: no match for 'operator=' in
'((My_engraver*)this)-My_engraver::slot_[i] = 0'
How can this be solved? Or is there a better approach to store events in
an array
the way I described above?
Thanks in advance!
Marc
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel