Boost logo

Boost Users :

From: Dale McCoy (dalestan_at_[hidden])
Date: 2006-05-02 13:35:59


> I've been working on something similar, and the best I've been able to
> come up with is this:
> <snip>
> If you have a limited range of var values, this should work fine. It's
> pretty tedious though,

That looks pretty well suited to (semi-)automated generation, either
with a separate script, or with something like:

#define _(x) case x: template_func<x>(); break;

void func(const int& var){
    switch (var){
        _(1)
        _(2)
    // etc
    }
}

#undef _

This doesn't solve the limited range of values problem, though.

Dale


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