Boost logo

Boost Users :

Subject: Re: [Boost-users] [Spirit][karma] Generating Pascal string like output
From: Olaf Meeuwissen (olaf.meeuwissen_at_[hidden])
Date: 2012-01-23 18:30:16

TONGARI <tongari95_at_[hidden]> writes:

> 2012/1/23 Olaf Meeuwissen <olaf.meeuwissen_at_[hidden]>
> [...]
> The phoenix::size and inherited attribute where two helpful cluebats,
> though.  With those (and fixing some of the stupidities in my original
> code) I've been able to come close but I always miss the first byte in
> the vector.  Any ideas why and how to fix that?
> That's why you need no_attribute[] if you cannot have karma::embed.
> Get this: 
> Used like:
>    no_attribute[pascal_string_size_[ _1 = size (_val) ]]

Together with a

  using custom_generator::no_attribute;

that does the trick nicely indeed and works fine with Boost 1.46.1.

For reference purposes, the full working example code attached. The
code assumes that no_attribute_directive.hpp is in the same directory
(or that a suitable include search path directive is given on the



Olaf Meeuwissen, LPIC-2           FLOSS Engineer -- AVASYS CORPORATION
FSF Associate Member #1962               Help support software freedom

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at