Add type_match function to see if two types are the same

This commit is contained in:
Jason Turner 2009-06-26 13:37:00 +00:00
parent ae3ce3fcb2
commit f8593a0927
2 changed files with 11 additions and 0 deletions

View File

@ -431,6 +431,11 @@ namespace dispatchkit
register_function(s, &multiply<Boxed_Value, Boxed_POD_Value, Boxed_POD_Value>, "*");
}
static bool type_match(Boxed_Value l, Boxed_Value r)
{
return l.get_type_info() == r.get_type_info();
}
static Boxed_Value bind_function(const std::vector<Boxed_Value> &params)
{
if (params.size() < 2)
@ -483,6 +488,7 @@ namespace dispatchkit
s.register_function(boost::shared_ptr<Proxy_Function>(new Dynamic_Proxy_Function(boost::bind(&bind_function, _1))),
"bind");
register_function(s, &type_match, "type_match");
register_function(s, &bool_and<bool, bool>, "&&");
register_function(s, &bool_or<bool, bool>, "||");
}

View File

@ -41,6 +41,11 @@ namespace dispatchkit
return *this;
}
bool operator==(const Type_Info &ti) const
{
return ti.m_type_info == m_type_info;
}
bool m_is_const;
bool m_is_reference;
bool m_is_pointer;