View Single Post
Old 08-19-2004, 12:35 PM  
darkone
Disabled
 
darkone's Avatar
 
Join Date: Dec 2001
Posts: 2,230
Default

I actually use similar optimizations already...

Code:
void foo(int lOperation)
{
  switch (lOperation) {
  case 0:
    DoSomethin1();
    break;
  case 1:
    DoSomething2();
    break;
  }
}
could be written as:

Code:
lpProc[2] = { DoSomething1, DoSomething2 };

void foo(int lOperation)
{
  lpProc[lOperation]();
}
darkone is offline   Reply With Quote