[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Help with C++ dereferencing
From: |
Carl Sorensen |
Subject: |
Help with C++ dereferencing |
Date: |
Sun, 18 Sep 2016 06:37:53 +0000 |
I'm working on solving the dot-column problem.
I have determined an algorithm that I believe will work to get the right dots,
and to do it configurably.
But I can't get the C++ to work properly.
I've added a new function to Dot_configuration,
Dot_configuration::suicide_excess_dots
In dot-configuration.hh:
struct Dot_configuration : public map<int, Dot_position>
{
Dot_formatting_problem const *problem_;
Dot_configuration (Dot_formatting_problem const &);
Real x_offset () const;
int badness () const;
void print () const;
Dot_configuration shifted (int k, Direction d) const;
void remove_collision (int p);
void suicide_excess_dots (int shift_limit);
};
In dot-configuration.cc:
void
Dot_configuration::suicide_excess_dots (int shift_limit)
{
for (Dot_configuration::const_iterator i (begin ());
i != end (); i++)
if (abs(i->first - i->second.pos_) > shift_limit)
{
Grob *d = i->second.dot_;
d->suicide ();
}
}
I'm trying to suicide a dot grob that is contained in the dot_ property of the
Dot_position element of the map.
But when I try to compile this, I get the error:
error: invalid use of incomplete type 'class Grob'
d->suicide ();
^
In file included from
/home/carl/lilypond-git/lily/include/dot-configuration.hh:23:0,
from /home/carl/lilypond-git/lily/dot-configuration.cc:21:
/home/carl/lilypond-git/lily/include/lily-proto.hh:72:7: error: forward
declaration of 'class Grob'
class Grob;
^
Can anybody (perhaps David K) give me a clue as to how I pull the grob out to
suicide it?
THanks,
Carl
- Help with C++ dereferencing,
Carl Sorensen <=