Boost logo

Boost Users :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-05-01 20:36:32


AMDG

Robert Dailey wrote:
> Hey guys,
>
> I was wondering if there was some sort of MPL Switch concept in the
> boost library. Before I go any further on that topic, let me first
> explain what I'm trying to do.
>
> I'm currently using a library that has several functions as follows:
>
> void SetParamFloat( char* name, float value );
> void SetParamInt( char* name, int value );
> void SetParamString( char* name, char* value );
>
> I'm creating a sort of facade around this library, and as a result I
> have a function that looks as follows:
>
> template< typename t_type >
> void SetParam( char* name, t_type value );
>
> <snip>
>
> Any help is greatly appreciated. I guess what I really need is some
> guidance on the matter. I strive for a generic way to implement this,
> but I don't want it to look messy, as most template code has the bad
> habit of turning out that way.

I think that the easiest way to get what you want is just to overload
SetParam for each type
that you need to deal with.

In Christ,
Steven Watanabe


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