
-----Original Message----- From: "Larry Evans" [cppljevans@suddenlink.net] Date: 22/02/2010 07:23 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] [fusion] runtime unsigned to a template argument compile-time unsigned On 02/22/10 10:02, Larry Evans wrote:
On 02/21/10 05:27, Hicham Mouline wrote: [snip]
3. Can I generate an array of function pointers to the various at<>() functions and call the right one at runtime?
The 2 attached files show how this can be done.
Obviously, instead of:
typedef void(* method_type )(void) ;
you'd have:
typedef double(* method_type )(void) ;
This could even be done for heterogeneous return types; however, in that case, a tagged variant. The tag for this variant would be the field index. In the attached code, this would be something like the super_numerals. ------------------------ This looks like it should go, already is in some library? I have many places where I read the index, and I would like to use the index as the template argument, thanks very much, will do,