<div>True that I just need limited type supported and not entire universe of types, I have also seen following, but it would mean to put it in series of if(is_int), elseif(is_char_ptr) kind of statements, switch statement would be more cleaner, that why I thought type_traits may offer cleaner solution. </div> <div> </div> <div>Performance is also criteria.<br><br> </div> <div><span class="gmail_quote">On 10/10/05, <b class="gmail_sendername">Christian Henning</b> <<a href="mailto:chhenning@gmail.com">chhenning@gmail.com</a>> wrote:</span> <blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">I took a look at the examples in the Boost::Any documentation and found this:<br><br>bool is_int(const boost::any & operand) <br>{<br> return operand.type() == typeid(int);<br>}<br><br>bool is_char_ptr(const boost::any & operand)<br>{<br> try<br> {<br> any_cast<const char *>(operand);<br> return true;<br> }<br> catch(const boost::bad_any_cast &) <br> {<br> return false;<br> }<br>}<br><br>bool is_string(const boost::any & operand)<br>{<br> return any_cast<std::string>(&operand);<br>}<br><br><br>Is that what you're looking for?<br><br>Christian <br><br>_______________________________________________<br>Boost-users mailing list<br><a href="mailto:Boost-users@lists.boost.org">Boost-users@lists.boost.org</a><br><a href="http://lists.boost.org/mailman/listinfo.cgi/boost-users"> http://lists.boost.org/mailman/listinfo.cgi/boost-users</a><br></blockquote></div><br>