Add dynamic_pointer_cast method to Shared_pointer

This methods is currently only used for casting an Io_channel
object to an Socket_io_channel object.
This commit is contained in:
Josef Söntgen 2012-05-08 12:16:13 +02:00 committed by Christian Helmuth
parent cba25cc1d6
commit 4ba1669b39
1 changed files with 6 additions and 0 deletions

View File

@ -145,6 +145,12 @@ namespace Noux {
T const* operator -> () const { return _ptr; }
operator bool () const { return _ptr != 0; }
template<typename To>
Shared_pointer<To> dynamic_pointer_cast()
{
return Shared_pointer<To>(dynamic_cast<To *>(_ptr), _alloc);
}
};
}