>
void foo<0>(int id, DecodeContext& dc) {}
int main(){
DecodeContext& dc= *(DecodeContext*)0;// junk for now
int id=std::rand(); // runtime dependent
foo<50>(id,dc);
return 0;
}
-Original Message-
From: Piotr Rak [mailto:piotr@gma
On 07/28/10 10:26, Richard Guenther wrote:
[snip]
You can use the flatten attribute to tell the compiler to inline all
calls in a given function, like
void __attribute__((flatten)) foo(void)
{
...
decode1();
...
}
and it will inline decode1() (and recursively all its callees).
[snip]
Will th
On 07/28/10 13:16, Piotr Rak wrote:
[snip]
Or you could just initialize static array of pointers, like that
(please note, that I never compiled code below):
[snip]
Piotr, something similar was proposed here:
http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/364c0dd5
Hi,
2010/7/28 Hite, Christopher :
>> Generally without knowing the compiler version you are using
>> it is hard to tell.
> I'll use whatever's best. Right now I'm still on 4.4.3. I'll probably
> upgrade soon to 4.5.
>
>> The same is true without a complete compilable testcase.
> I didn't want to
On 07/28/10 10:53, Hite, Christopher wrote:
[snip]
struct DecodeContext;
struct M1{
static const int id=1;
static void decode(DecodeContext& ){}
};
struct M2{
static const int id=2;
static void decode(DecodeContext& ){}
};
struct M3{
static const int id=
> Generally without knowing the compiler version you are using
> it is hard to tell.
I'll use whatever's best. Right now I'm still on 4.4.3. I'll probably
upgrade soon to 4.5.
> The same is true without a complete compilable testcase.
I didn't want to make a test case that depends on boost::mp
On 07/28/10 09:37, Hite, Christopher wrote:
[snip]
I'm tring to use the template compiler to generate equivalent code. I
have a mpl::list of packet descriptions like this:
struct Packet1{
static const int id=1;
void decode();
};
I then use boost::
On Wed, Jul 28, 2010 at 4:37 PM, Hite, Christopher
wrote:
>
>
>
> I'm writing a decoder using a meta programming techniques alla
> boost::mpl and I'd like to know if I'm asking too much of the compiler.
>
> Basically I've got lots of packet types with different ids. The
> classical way to write t
I'm writing a decoder using a meta programming techniques alla
boost::mpl and I'd like to know if I'm asking too much of the compiler.
Basically I've got lots of packet types with different ids. The
classical way to write these would be a switch case
int id;
switch(id){