Is there any way that that won't run typeid if it is already a const type_info & ?Code:bool is_type2(const boost::any & operand, const type_info & dtype) { //comparison of types using a typeinfo if (operand.type() == dtype) return true; return false; } #define is_type(a,b) is_type2(a,typeid(b))
Possibly using : ?
That way, the user can either do this:
is_type(anydata,typeinfodata); // don't run typeid!
OR
is_type(anydata,int); // run typeid
or do I have to have an is_type as well as is_type2 ?