Boost logo

Boost Users :

Subject: Re: [Boost-users] [karma] Losing attribute?
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2010-02-24 10:25:55


Sebastian,

> 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<Iterator, GEOPOINT()> point;
> rule<Iterator, Contour(int)> contour;
> rule<Iterator, locals<int>, Poly()> polygon;
> rule<Iterator, Poly()> 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?

Could you please provide a minimal, but still self-contained example I could
run? That would help me to give you a proper answer to your question. From
what I can see your code should work just fine.

Regards Hartmut

---------------
Meet me at BoostCon
www.boostcon.com


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net