[webkit-help] Passing RefPtr<T> to function expecting Ref<T>

Ryosuke Niwa rniwa at webkit.org
Sun Mar 26 23:37:37 PDT 2017

On Sun, Mar 26, 2017 at 12:28 PM, Konstantin Tokarev <annulen at yandex.ru> wrote:
> Hello,
> What is the most appropriate way to do subject, given that ptr is RefPtr<T>?
> 1. f(*ptr)
> 2. f(ptr.releaseNonNull())

Both forms are depending on what you're trying to do. 1 is appropriate
and necessary if ptr is used after the call to f but it results in an
unnecessary ref-churn if ptr is never used after the call. 2 is
appropriate if ptr is never after the call, and would avoid a

- R. Niwa

More information about the webkit-help mailing list