hi, Qzi

Difference between reference and weak refence is very similar to the
difference between tr1::shared_ptr and tr1::weak_ptr. weak (reference/smart
pointer) is necessary for avoiding reference cycle.

Say, A and B are instances of Reference<>(shared_ptr<>). If A hold a
reference of B and B hold a reference of A, we call these two objects have
an refernce cycle. A and B won't release even if they are out of their life
cricle, and this is why we need weak reference.

The attachment is an sample of weak_ptr, you can run it and find out why
weak_ptr can break reference cycle. And you will get your answer.

Regards,
hanbo


2010/5/16 Qzi er <hotseason...@gmail.com>

> what's the deference between  weak reference and hard reference ?
>
> I can't understande the wiki below !
>
>
> http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/C%2B%2B/Using_Weak_References
>
> Is there other core code show  what is weak distinguish  hard ?
> --
>  作智慧的减法 ...
>
>                体会生活的微妙的富足  ...
>
>      嗯 ...
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org

Reply via email to