On Sun, 2014-11-02, K' Dash wrote:
> Still I am unable to understand that what you guys are saying. You
> guys discussing with each other instead of teaching me. :)
That's what we do best these days.
> see this link,
>
>
http://www.nsnam.org/docs/release/3.21/doxygen/ptr_8h_source.html
>
> when I click (by using eclipse IDE) on Ptr<Mac48Address> Mac;
> it showed me the "class Ptr " at line number 60. you can see this class from above link.
>
> generic command is Ptr<classname> variable;
> so don't confuse yourself with Mac48Address. Now please tell me what is the difference between
>
> Mac48Address* Mac;
>
> and
>
> Ptr<Mac48Address> Mac;
>
> where Mac48Address is a class name
Ignore that line 60. If you look deeper in that Doxygen-generated
documentation, you find:
template<typename T>
class ns3::Ptr< T >
smart pointer class similar to boost::intrusive_ptr
This smart-pointer class assumes that the underlying type provides
a pair of Ref and Unref methods which are expected to increment
and decrement the internal refcount of the object instance.
This implementation allows you to manipulate the smart pointer as
if it was a normal pointer: you can compare it with zero, compare
it against other pointers, assign zero to it, etc.
...
I'm not very familiar with smart pointers so I might be missing
something, but this documentation seems rather poor. Am I supposed to
read the documentation for boost::intrusive_ptr to understand what
ns3::Ptr does?