|
Boost Users : |
Subject: [Boost-users] Preprocessor Sum Shift
From: Mitch Besser (bessermt_at_[hidden])
Date: 2009-10-22 11:43:59
I would like to take the following Sequence of Tuples:
((A, 1)) ((B, 1)) ((C, 1)) ((D, 2)) ((E, 4))
and create a summation as follows:
((A, 0)) ((B, 1)) ((C, 2)) ((D, 3)) ((E, 5))
I've been able to produce the following summation:
((A, 1)) ((B, 2)) ((C, 3)) ((D, 5)) ((E, 9))
Which is close to correct but is shifted. No matter what I try, I can't
create the desired result. It seems the preprocessor library just doesn't
have enough power to do the job, but maybe there's a way to do this I can't
see.
For those interested, the input represents member variables and their
respective sizes. The output is member variables and their respective
offsets within the struct (byte aligned in the example case). The ultimate
goal is to generate some test case code, so feel free to suggest a
non-preprocessor way to do the same thing.
As an aside, I get warnings in the case where there is only 1 Tuple in the
Sequence ((A, 1)). It would be nice to solve this too.
Thanks
email: <pdx247_at_[hidden]>
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