Bug 23

Summary: Callbacks cannot be created for member methods and Ptr<T> object instances
Product: ns-3 Reporter: Mathieu Lacage <mathieu.lacage>
Component: coreAssignee: ns-bugs <ns-bugs>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P1    
Version: pre-release   
Hardware: PC   
OS: Linux   

Description Mathieu Lacage 2007-05-13 03:52:32 UTC
the following code will not compile:

Ptr<MyObject> p;
MakeCallback (&MyObject::MyMethod, p);

The solution probably would require us to define a CallbackTraits<T> template class and specialize it for the Ptr class:

template <typename T>
struct CallbackTraits
{
  typedef T * PointerType;
};

template <>
struct CallbackTraits<Ptr>
{
  typedef Ptr<T> PointerType
};

and use CallbackTraits<T>::PointerType in callback.h wherever we use T *.