Hello,
I'd like to convert this run-time assertion to a compile time MPL check:
template <class T>
bool SetOption(COptionInfo& o, const char* key, const T& value)
{
assert( typeid(T)==typeid(bool)
|| typeid(T)==typeid(int)
|| typeid(T)==typeid(double)
|| typeid(T)==typeid(string));
...etc...
As you can probably guess, this is a template function that should only
be called with types of int, bool, std::string or double.
From what I've read in this newsgroup, the boost::mpl library should be
able to handle this. But, I wouldn't be surprised if there was an easy
C++ solution too.
Thanks,
Derek Ross.
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
- Re: [boost] How to do this in with boost --assert(typeid(T... Derek Ross
- Re: [boost] How to do this in with boost --assert(typ... Peter Dimov
- Re: [boost] How to do this in with boost --assert... David Abrahams
- [boost] Re: How to do this in with boost -- ... Daniel Frey
- Re: [boost] Re: How to do this in with b... David Abrahams
- [boost] Re: Re: How to do this in wi... Daniel Frey
- Re: [boost] How to do this in with boost -- assert(ty... Daniel Frey
- [boost] Re: How to do this in with boost -- as... Derek Ross
- [boost] Re: How to do this in with boost -- ... Daniel Frey
- Re: [boost] Re: How to do this in with b... Paul Mensonides
- Re: [boost] Re: How to do this in w... Terje Slettebų