Derek Ross wrote: > > 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...
Uhm... don't know about MPL, but isn't this a good example for type_traits? Something like: template <class T> bool SetOption(COptionInfo& o, const char* key, const T& value) { BOOST_STATIC_ASSERT( boost::is_same< T, bool >::value || boost::is_same< T, int >::value || boost::is_same< T, double >::value || boost::is_same< T, std::string >::value ); ...etc... } Regards, Daniel -- Daniel Frey aixigo AG - financial training, research and technology Schloß-Rahe-Straße 15, 52072 Aachen, Germany fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99 eMail: [EMAIL PROTECTED], web: http://www.aixigo.de _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost