On Thu, May 1, 2008 at 7:36 PM, Steven Watanabe <watanabesj@gmail.com> wrote:
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.

I thought about that too, but I am always curious as to what other solutions boost could bring to the table. After this much research I'm starting to find that overloads seem to be the cleanest solution. Thanks for helping Steven.