Boost logo

Boost Users :

From: Geoffrey Irving (irving_at_[hidden])
Date: 2005-08-26 11:21:11


Hello,

I would like to be able to write code like this:

    int i;
    for F in LIST_OF_TYPES
        complicated_function<F>(i);

where this code is inside some other function which is inside a class
templatized over LIST_OF_TYPES. Given the lack of nested functions and
classes in C++ functions, am I correct in thinking that it's impossible
to do this sort of thing inside another function?

In my particlar case, all the complicated code has already been factored
into complicated_function, and there are only ever two LISTS_OF_TYPES, so
my current solution is just to manually specialize over LISTS_OF_TYPES.
However, this kind of construct often appears several times (with different
complicated_functions) in a given outer function, so it would be very nice
to only have to write down the high level structure once.

Thanks,
Geoffrey


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