diff --git a/src/core/callback.h b/src/core/callback.h index f05751efa..1986e4928 100644 --- a/src/core/callback.h +++ b/src/core/callback.h @@ -23,6 +23,7 @@ #define CALLBACK_H #include "reference-list.h" +#include "fatal-error.h" namespace ns3 { @@ -292,6 +293,16 @@ public: return false; } } + void Assign (CallbackBase const &other) { + if (!CheckType (other)) + { + NS_FATAL_ERROR ("Incompatible types. (feed to \"c++filt -t\")" + " got=" << typeid (other).name () << + ", expected=" << typeid (*this).name ()); + } + const Callback *goodType = static_cast *> (&other); + *this = *goodType; + } private: virtual CallbackImplBase *PeekImpl (void) const { return m_impl.Get ();