Hi,
I've got a Karma generator that should emit a vector of records, writing
out the index of every entry at the start. My code looks like this (note
that GEOPOINT is a fusion-adapted struct of two doubles):
typedef std::vector<GEOPOINT> Contour;
typedef std::vector<Contour> Poly;
rule point;
rule contour;
rule polygon;
rule start;
point = L';' << double_ << L';' << double_;
contour = L";SUBPOLYGON " << lit(_r1 - 1) << L" POINTS " <<
lit(phoenix::size(_val)) << L" MASK XOR" << *point;
polygon = L"POLYGON COUNT " << lit(phoenix::size(_val)) <<
*(contour(_a)[++_a]);
start = polygon;
This doesn't work. If I take away the modification of _a, it works, except
that of course the index is 0 in every iteration. But the moment I modify
_a in any way (including assigning to it anywhere in the polygon rule),
suddenly contour seems to get an incorrect attribute: it never fails, but
never emits points either, i.e. I get an endless string of ";SUBPOLYGON 1
POINTS 0 MASK XOR;SUBPOLYGON 2 POINTS 0 MASK XOR;SUBPOLYGON 3 POINTS 0 MASK
XOR...".
Any idea why that is?
Sebastian