mirror of https://github.com/CGAL/cgal
Add a convenience function for the idiom "if(obj.is<Point>())"...
This commit is contained in:
parent
6cf035c3ad
commit
b9a62e057c
|
|
@ -40,6 +40,9 @@ Objects of type \ccRefName\ are normally created using the global function
|
|||
\ccMethod{bool empty();}{returns true, if \ccVar\ does not
|
||||
contain an object.}
|
||||
|
||||
\ccMethod{template<class T> bool is();}
|
||||
{returns true, iff \ccVar\ contains an object of type \ccc{T}.}
|
||||
|
||||
\ccMethod{const std::type_info & type() const;}
|
||||
{returns the type information of the contained type,
|
||||
or \ccc{typeid(void)} if empty.}
|
||||
|
|
|
|||
|
|
@ -131,6 +131,12 @@ class Object
|
|||
return empty();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool is() const
|
||||
{
|
||||
return NULL != dynamic_cast<const Wrapper<T> *>(Ptr());
|
||||
}
|
||||
|
||||
const std::type_info & type() const
|
||||
{
|
||||
return empty() ? typeid(void) : Ptr()->type();
|
||||
|
|
|
|||
Loading…
Reference in New Issue