This implementation of Comparator is designed to allows objects in a Collection to be sorted or tested for equality based on the value of the Object being Pointed to and not the value of the contained pointer in the Pointer instance.
More...
Public Member Functions |
virtual | ~PointerComparator () |
virtual bool | operator() (const Pointer< T, R > &left, const Pointer< T, R > &right) const |
virtual int | compare (const Pointer< T, R > &left, const Pointer< T, R > &right) const |
virtual | ~Comparator () |
virtual bool | operator() (const Pointer< T, R > &left, const Pointer< T, R > &right) const =0 |
| Implementation of the Binary function interface as a means of allowing a Comparator to be passed to an STL Map for use as the sorting criteria.
|
virtual int | compare (const Pointer< T, R > &o1, const Pointer< T, R > &o2) const =0 |
| Compares its two arguments for order.
|
template<typename T, typename R = decaf::util::concurrent::atomic::AtomicRefCounter>
class decaf::lang::PointerComparator< T, R >
This implementation of Comparator is designed to allows objects in a Collection to be sorted or tested for equality based on the value of the Object being Pointed to and not the value of the contained pointer in the Pointer instance.
This can be useful in the case where a series of values in a Collection is more efficiently accessed in the Objects Natural Order and not the underlying pointers location in memory.
Also this allows Pointer objects that Point to different instances of the same type to be compared based on the comparison of the object itself and not just the value of the pointer.