Shore Programmer's Manual - 3 November 94


equal \- compare references for equality


#include <ShoreApp.h>
int REF(T)::operator==(const REF(T) &ref) const;
int REF(T)::operator!=(const REF(T) &ref) const;
int REF(T)::operator==(const T *p) const;
int REF(T)::operator!=(const T *p) const;
    REF(T)::operator int() const;


These operators implement equality comparisons among refs. The first two forms indicate whether two REF(T)s point to the same object. The second two forms indicate whether the ref points to the same object as the given virtual memory pointer. The final form returns 0 if the ref is nil, 1 otherwise.


REF(Part) p1, p2;

if(p1 == p2) ...

if(p1 != 0) ...

if(p1) ...
The first if-statement succeeds if p1 and p2 point to the same part object. The second and third if-statements are equivalent, and they succeed if p1 is not a nil ref.


The forms of the equality operator that take a virtual memory pointer are only intended for use with a parameter of 0.

In the current release of Shore, it is safe to compare refs whose targets have been destroyed. But in general, this practice is discouraged, as it may not be supported in future Shore releases.


This manual page applies to Version 0.1 of theShore software.


The Shore project is sponsored by the Advanced Research Project Agency, ARPA order number 018 (formerly 8230), monitored by the U.S. Army Research Laboratory under contract DAAB07-91-C-Q518.


Copyright (c) 1994 Computer Sciences Department, University of Wisconsin -- Madison. All Rights Reserved.


ref(oc) , assign(oc) , construct(oc) .