<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>&nbsp;</div>
<div>Performance is also criteria.<br><br>&nbsp;</div>
<div><span class="gmail_quote">On 10/10/05, <b class="gmail_sendername">Christian Henning</b> &lt;<a href="mailto:chhenning@gmail.com">chhenning@gmail.com</a>&gt; 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 &amp; operand)
<br>{<br>&nbsp;&nbsp; return operand.type() == typeid(int);<br>}<br><br>bool is_char_ptr(const boost::any &amp; operand)<br>{<br>&nbsp;&nbsp; try<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; any_cast&lt;const char *&gt;(operand);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return true;<br>&nbsp;&nbsp; }<br>&nbsp;&nbsp; catch(const boost::bad_any_cast &amp;)
<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return false;<br>&nbsp;&nbsp; }<br>}<br><br>bool is_string(const boost::any &amp; operand)<br>{<br>&nbsp;&nbsp; return any_cast&lt;std::string&gt;(&amp;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>