class ref
Use (conceptually) non-owning type ref when type of reference (local, global or weak global) doesn’t matter. Use local_ref, global_ref or weak_ref explicitly to specify owning semantics. For example, use global_ref or weak_ref to store a reference in your C++ object when returning control to Java.
Info
While ref is conceptually a non-owning type, it is actually implemented to take ownership when moved to, and not to take ownership when copied to. This allows both zero overhead parameters (copy) and safe return of temporaries (move).