MemberHolder Class Template Reference

Detailed Description

template<class T>
class coherence::lang::MemberHolder< T >

MemberHolder is a thread-safe handle implementation which supports referencing Objects as either Handles or Views.

MemberHolder can safely be used in place of View but adds the ability to attempt a safe down cast to a Handle. This differs from the C++ const_cast in that the down cast will only succeed if the MemberHolder had been assigned from a Handle, an assignment from a View results in a MemberHolder whose down cast operation will throw a ClassCastException.

MemberHolder is not for general use, instead it is a convenience handle type which can be used for container like classes, which need to be able to contain both Handles and Views.

Note: In the rare case that a MemberHolder is declared via the mutable keyword, the MemberHolder must be informed of this fact by setting fMutable to true during construction.