|
JASSv2
|
A boxed pointer object used so that comparison operators work on the value pointed to rather than the pointer. More...
#include <pointer_box.h>

Public Member Functions | |
| pointer_box () | |
| Constructor. | |
| pointer_box (TYPE *to) | |
| Constructor. More... | |
| int | compare (const pointer_box< TYPE > to) const |
| Compare for less than, equal, or greater than. More... | |
| bool | operator< (const pointer_box< TYPE > to) const |
| Compare for less than (*a < *b) || (*a == *b && a < b). More... | |
| bool | operator< (TYPE *to) const |
| Compare for less than (*a < *b) || (*a == *b && a < b). More... | |
| bool | operator<= (const pointer_box< TYPE > to) const |
| Compare for less than or equal to. More... | |
| bool | operator> (const pointer_box< TYPE > to) const |
| Compare for greater than. More... | |
| bool | operator>= (const pointer_box< TYPE > to) const |
| Compare for greater than or equal to. More... | |
| bool | operator== (const pointer_box< TYPE > to) const |
| Compare for equal to. More... | |
| bool | operator!= (const pointer_box< TYPE > to) const |
| Compare for not equal to. More... | |
| TYPE * | pointer () const |
| Return the pointer this box holds. More... | |
| TYPE * | operator-> () const |
| Pointer to member operator. More... | |
| TYPE & | operator* () const |
| Value of operator. More... | |
Static Public Member Functions | |
| static int | cmp (const pointer_box< TYPE > first, const pointer_box< TYPE > to) |
| Compare for less than, equal, or greater than. More... | |
| static bool | less_than (TYPE *first, TYPE *to) |
| Compare for less than (*a < *b) || (*a == *b && a < b). More... | |
| static bool | less_than (TYPE *first, const pointer_box< TYPE > to) |
| Compare for less than (*a < *b) || (*a == *b && a < b). More... | |
| static bool | greater_than (TYPE *first, TYPE *to) |
| Compare for more than (*a > *b) || (*a == *b && a > b). More... | |
| static bool | greater_than (TYPE *first, pointer_box< TYPE > to) |
| Compare for more than (*a > *b) || (*a == *b && a > b). More... | |
| static void | unittest (void) |
| Unit test this class. | |
Private Attributes | |
| TYPE * | element |
| We actually store a reference to the object rather than a pointer, but they're the same size. | |
A boxed pointer object used so that comparison operators work on the value pointed to rather than the pointer.
All the usual pointer operations should work, except for comparisons which compare to the value pointed to rather than the pointer itself. This is useful when, for example, an ordered conatiner is being used to store pointers (or, for example, std::sort() an array of pointers based on the values those pointers point to). Note, ties are broken on the value of the pointer - that means that if the pointers are into an array then the earlier memeber of the array compares to less than the
|
inline |
Constructor.
| to | [in] The object we are being a pointer to. |
|
inlinestatic |
Compare for less than, equal, or greater than.
| first | [in] The object we are Compareing to. |
| to | [in] The object we are Compareing to. |
|
inline |
Compare for less than, equal, or greater than.
| to | [in] The object we are Compareing to. |
|
inlinestatic |
Compare for more than (*a > *b) || (*a == *b && a > b).
| first | [in] This object |
| to | [in] The object we are comparing to. |
|
inlinestatic |
Compare for more than (*a > *b) || (*a == *b && a > b).
| first | [in] This object |
| to | [in] The object we are comparing to. |
|
inlinestatic |
Compare for less than (*a < *b) || (*a == *b && a < b).
| first | [in] This object |
| to | [in] The object we are comparing to. |
|
inlinestatic |
Compare for less than (*a < *b) || (*a == *b && a < b).
| first | [in] This object |
| to | [in] The object we are comparing to. |
|
inline |
Compare for not equal to.
| to | [in] The object we are Compareing to. |
|
inline |
Value of operator.
|
inline |
Pointer to member operator.
|
inline |
Compare for less than (*a < *b) || (*a == *b && a < b).
| to | [in] The object we are comparing to. |
|
inline |
Compare for less than (*a < *b) || (*a == *b && a < b).
| to | [in] The object we are comparing to. |
|
inline |
Compare for less than or equal to.
| to | [in] The object we are Compareing to. |
|
inline |
Compare for equal to.
| to | [in] The object we are Compareing to. |
|
inline |
Compare for greater than.
| to | [in] The object we are Compareing to. |
|
inline |
Compare for greater than or equal to.
| to | [in] The object we are Compareing to. |
|
inline |
Return the pointer this box holds.
1.8.13