add a new overloaded Assign method

This commit is contained in:
Mathieu Lacage
2007-05-31 11:03:26 +02:00
parent e7abed2def
commit 65f215eee2

View File

@@ -331,6 +331,16 @@ public:
const Callback<R, T1,T2,T3,T4,T5> *goodType = static_cast<const Callback<R,T1,T2,T3,T4,T5> *> (&other);
*this = *goodType;
}
void Assign (Ptr<CallbackImplBase> other) {
CallbackImpl<R,T1,T2,T3,T4,T5> *impl = dynamic_cast<CallbackImpl<R,T1,T2,T3,T4,T5> *> (PeekPointer (other));
if (other == 0)
{
NS_FATAL_ERROR ("Incompatible types. (feed to \"c++filt -t\")"
" got=" << typeid (other).name () <<
", expected=" << typeid (*impl).name ());
}
*this = Callback<R,T1,T2,T3,T4,T5> (impl);
}
private:
virtual CallbackImpl<R,T1,T2,T3,T4,T5> *PeekImpl (void) const {
return PeekPointer (m_impl);