[boos][switch] What do you think?

Hi all, I have been writing a BOOST_SWITCH(...) statement, which tries to emulate the C++ switch() for C++ objects. string variable = "some string"; string string0 = "0", string1 = "1", string2 = "2"; BOOST_SWITCH( variable , BOOST_CASE( string0, std::cout << "error" << std::endl; BOOST_BREAK; ); BOOST_CASE( string1, std::cout << "error" << std::endl; BOOST_BREAK; ); BOOST_DEFAULT( BOOST_SWITCH( string2, BOOST_DEFAULT( std::cout << "embedded switch statments work" << std::endl; ); ); std::cout << "end of secound switch statment" << std::endl; std::cout << "reached default" << std::endl; ); ); The above code would work correctly (msvc). However, for "const char *", the compiler could not deduce template. I have written an specialized "const char *" template however, still could not deduce template. Any suggestions? template<class T> switch_; template<> switch_<const char *>; With best regards Kasra Nassiri
participants (1)
-
Kasra Nassiri(Math & ComSci)