-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Larry Evans Sent: 10 February 2010 13:10 To: boost-users@lists.boost.org Subject: Re: [Boost-users] generate structs with all combinations of members from a given struct
On 02/09/10 16:12, Hicham Mouline wrote: [snip]
I have another problem for now.
What about precompiled headers? Microsoft provides them:
http://msdn.microsoft.com/en-us/library/szfdksca(VS.71).aspx
as well as gcc:
http://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html
HTH.
-Larry
Ah yes, I will look into that, gcc and msvc are the only 2 compilers I use
anyways, thanks,
Daniel, in the attached file in
http://lists.boost.org/boost-users/2010/02/56100.php, in line 69, I am
generating the struct name with a BOOST_PP_WHILE invocation, I then need to
reuse the struct name to define a constructor for the struct, so I reinvoke
the BOOST_PP_WHILE.
Clearly, this is wasted reprocessing, but I don't see how to avoid it.
Actually, it's not the struct constructor I need to write, but the
assignment operator instead.
The 2nd question is how to generate the struct definition including the
operator= on multiple lines instead of just 1.
Here is an example of the generation at work
struct S {
double d1;
int i2;
long l3;
};
1 of the 7 structs generated will look like
struct S_i2_l3 {
S_i2_l3& operator=( const S& rhs )
{
i2 = rhs.i2;
l3 = rhs.l3;
}
int i2;
long l3;
};
All the S_s should be generated just once ( I will look at precompiled
headers for this )
Later on, I PP-generate these types
typedef boost::multi_array, and just filled/read
from the S cells just the relevant fields, I would be wasting memory.
Thanks,