CrystalSpace

Public API Reference

csPtr< T > Class Template Reference

A pointer encapsulator. More...

#include <csutil/ref.h>

Inheritance diagram for csPtr< T >:

List of all members.

Friends

class csRef< T >

Detailed Description

template<class T>
class csPtr< T >

A pointer encapsulator.

Represents a single, owned, one-time-transferable reference to an object and should be used only as the return value of a function, or when creating a brand new object which is assigned directly to a csRef<>. csPtr<> simply stores the pointer (it never invokes IncRef() or DecRef()). It is very specialized, and exists solely as a mechanism for transferring an existing reference into a csRef<>.

Important: There is only one valid way to use the result of a function which returns a csPtr<>: assign it to a csRef<>.

Thread safety:
It is not safe to use a csPtr<> instance concurrent in multiple threads. If you need to work with an object in multiple threads, first assign it to a csRef<> on the originating thread (and only there) and pass around the csRef<> (or a copy).
Remarks:
An extended explanation on smart pointers - how they work and what type to use in what scenario - is contained in the User's manual, section "Correctly Using Smart Pointers".

Definition at line 94 of file ref.h.


The documentation for this class was generated from the following file:

Generated for Crystal Space 2.1 by doxygen 1.6.1